注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

临颍中远电脑科技

专业装机,网吧维护,电脑维修,网络监控,数据恢复,

 
 
 

日志

 
 

网吧改分辨率和壁纸  

2010-08-31 13:55:04|  分类: AU3 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

#Region AutoIt3Wrapper 预编译参数(完整参数)
;** AUT2EXE 设置
#AutoIt3Wrapper_Icon=mozilla.ico                           ;需要使用的图标(路径)名称
#AutoIt3Wrapper_UseUpx= y       
;===============================================================================================================
;** 目标程序资源信息
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Comment= thesnow 's wallpaper      ;注释
#AutoIt3Wrapper_Res_Description= 自然是修改壁纸和分辨率啦               ;详细信息
#AutoIt3Wrapper_Res_Fileversion=  1.0.0.0              ;文件版本
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=  ;(Y/N/P)自动更新版本  . 默认=N P=提示
#AutoIt3Wrapper_Res_LegalCopyright=thesnow             ;版权
#EndRegion
 
#NoTrayIcon
#include <GDIPlus.au3>
$pc=@ComputerName
$pcno=Int(StringRegExpReplace(@ComputerName,"[a-zA-Z]",""))
$ini=IniReadSection(@ScriptDir & '\ChangeScreenRes.ini','setting')
 
If Not @error Then
        For $i= 1 to $ini[0][0]
                If StringInStr($pc,$ini[$i][0]) Then
                        $k=StringSplit($ini[$i][1],";")
                        If @error Then ContinueLoop
                        If $k[0]<>6 Then ContinueLoop
                        If $pcno >= $k[1] And $pcno <= $k[2] Then
                                _ChangeScreenRes($k[3],$k[4],$k[5],$k[6])
                        EndIf
                EndIf
        Next
EndIf
 
If IniRead(@ScriptDir & '\ChangeScreenRes.ini',"image",@ComputerName,"") <> "" Then
        _ChangeDesktopWallpaper(IniRead(@ScriptDir & '\ChangeScreenRes.ini',"image",@ComputerName,"0"),2)
Else
        _ChangeDesktopWallpaper(IniRead(@ScriptDir & '\ChangeScreenRes.ini',"image",StringRight($pc,1),"0"),2) 
EndIf
 
Func _ChangeDesktopWallpaper($image, $style = 0)
;===============================================================================
;
; Function Name:    _ChangeDesktopWallpaper
; Description:       Update WallPaper Settings
; Usage:              _ChangeDesktopWallPaper(@WindowsDir & '\' & 'zapotec.bmp',1)
; Parameter(s):     $image - Full Path to BitMap File (*.bmp)
;                              [$style] - 0 = Centered, 1 = Tiled, 2 = Stretched
; Requirement(s):   None.
; Return Value(s):  On Success - Returns 0
;                   On Failure -   -1 
; Author(s):        FlyingBoz
; Thanks:        Larry - DllCall Example - Tested and Working under XPHome and W2K Pro
;                     Excalibur - Reawakening my interest in Getting This done.
;
;===============================================================================
  If Not FileExists($image) Then Return -1
  $image=FileGetLongName($image)
  If StringRight($image,"3") <> "bmp" Then
                _GDIPlus_Startup ()
                $hImage = _GDIPlus_ImageLoadFromFile ($image)
                $sCLSID = _GDIPlus_EncodersGetCLSID ("BMP")
                $tData = DllStructCreate("int Data")
                DllStructSetData($tData, "Data", $GDIP_EVTTRANSFORMROTATE90)
                $tParams = _GDIPlus_ParamInit (1)
                _GDIPlus_ParamAdd ($tParams, $GDIP_EPGTRANSFORMATION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Data"))
                _GDIPlus_ImageSaveToFileEx ($hImage, "c:\thesnow.bmp", $sCLSID, DllStructGetPtr($tParams))
                _GDIPlus_ShutDown ()
        Else
                FileCopy($image,"c:\thesnow.bmp",1)
        EndIf
 ;The $SPI*  values could be defined elsewhere via #include - if you conflict,
 ; remove these, or add if Not IsDeclared "SPI_SETDESKWALLPAPER" Logic
  Local $SPI_SETDESKWALLPAPER = 20
  Local $SPIF_UPDATEINIFILE = 1
  Local $SPIF_SENDCHANGE = 2
  Local $REG_DESKTOP= "HKEY_CURRENT_USER\Control Panel\Desktop"
  if $style = 1 then
  RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 1)
  RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", 0)
Else
  RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 0)
  RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", $style)
EndIf
 
 
  DllCall("user32.dll", "int", "SystemParametersInfo", _
        "int", $SPI_SETDESKWALLPAPER, _
        "int", 0, _
        "str", "c:\thesnow.bmp", _
        "int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE))
  Return 0
EndFunc  ;==>_ChangeDesktopWallpaper
 
 
;===============================================================================
;
; 函数名称:    _ChangeScreenRes()
; 详细信息:    修改 屏幕分辨率,刷新率.
; 版本:          1.0.0.1
; 参数:     $i_Width - 屏幕宽度(如1024X768 中的 1024)
;             $i_Height - 屏幕高度(如1024X768 中的 768)
;             $i_BitsPP -桌面颜色深度(如 32BIT,32位)
;             $i_RefreshRate - 屏幕刷新率(如 75 MHZ).
; 需求      AutoIt 测试版 > 3.1 以上
; 返回值  :      成功,屏幕更新,@ERROR = 0
;                   失败,屏幕不更新, @ERROR = 1
; 论坛:         [url]http://www.autoitscript.com/forum/index.php?showtopic=20121[/url]
; 作者:        Original code - psandu.ro
;                Modifications - PartyPooper
; 翻译:        thesnow
;
;===============================================================================
Func _ChangeScreenRes($i_Width = @DesktopWidth, $i_Height = @DesktopHeight, $i_BitsPP = @DesktopDepth, $i_RefreshRate = @DesktopRefresh)
Local Const $DM_PELSWIDTH = 0x00080000
Local Const $DM_PELSHEIGHT = 0x00100000
Local Const $DM_BITSPERPEL = 0x00040000
Local Const $DM_DISPLAYFREQUENCY = 0x00400000
Local Const $CDS_TEST = 0x00000002
Local Const $CDS_UPDATEREGISTRY = 0x00000001
Local Const $DISP_CHANGE_RESTART = 1
Local Const $DISP_CHANGE_SUCCESSFUL = 0
Local Const $HWND_BROADCAST = 0xffff
Local Const $WM_DISPLAYCHANGE = 0x007E
If $i_Width = "" Or $i_Width = -1 Then $i_Width = @DesktopWidth ; default to current setting
If $i_Height = "" Or $i_Height = -1 Then $i_Height = @DesktopHeight ; default to current setting
If $i_BitsPP = "" Or $i_BitsPP = -1 Then $i_BitsPP = @DesktopDepth ; default to current setting
If $i_RefreshRate = "" Or $i_RefreshRate = -1 Then $i_RefreshRate = @DesktopRefresh ; default to current setting
Local $DEVMODE = DllStructCreate("byte[32];int[10];byte[32];int[6]")
Local $B = DllCall("user32.dll", "int", "EnumDisplaySettings", "ptr", 0, "long", 0, "ptr", DllStructGetPtr($DEVMODE))
If @error Then
 $B = 0
 SetError(1)
 Return $B
Else
 $B = $B[0]
EndIf
If $B <> 0 Then
 DllStructSetData($DEVMODE, 2, BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_BITSPERPEL, $DM_DISPLAYFREQUENCY), 5)
 DllStructSetData($DEVMODE, 4, $i_Width, 2)
 DllStructSetData($DEVMODE, 4, $i_Height, 3)
 DllStructSetData($DEVMODE, 4, $i_BitsPP, 1)
 DllStructSetData($DEVMODE, 4, $i_RefreshRate, 5)
 $B = DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_TEST)
 If @error Then
  $B = -1
 Else
  $B = $B[0]
 EndIf
 Select
  Case $B = $DISP_CHANGE_RESTART
   $DEVMODE = ""
   Return 2
  Case $B = $DISP_CHANGE_SUCCESSFUL
   DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_UPDATEREGISTRY)
   DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, _
     "int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width)
   $DEVMODE = ""
   Return 1
  Case Else
   $DEVMODE = ""
   SetError(1)
   Return $B
 EndSelect
EndIf
EndFunc ;==>_ChangeScreenRes

 

 

ini:
;注:b=1;2;800;600;32;75中的b代表计算机名称中包含的字符(多个可以),1;2代表计算机名称中的数字.这里是1号机到2号机,800X600的分辨率,32位色,75MHZ的刷新率

[setting]
b=1;2;800;600;32;75
c=1;300;1024;768;32;85
[image]
;编号是机器号尾数
0=wallpaper.JPG
1=wallpaper.JPG
2=wallpaper.JPG
3=wallpaper.JPG
4=wallpaper.JPG
5=wallpaper.JPG
6=wallpaper.JPG
7=wallpaper.JPG
8=wallpaper.JPG
9=wallpaper.JPG

  评论这张
 
阅读(373)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017