레이블이 System인 게시물을 표시합니다. 모든 게시물 표시
레이블이 System인 게시물을 표시합니다. 모든 게시물 표시

2016. 3. 13.

해상도 변경하기

[출처:http://autohotkey.co.kr/b/1-1268]



system_path = %A_WinDir%system
if ( A_OSType != WIN32_WINDOWS )
   system_path = %system_path%32
  
id_image_list := IL_Create( 1, 0, 0 )
IL_Add( id_image_list, system_path "shell32.dll", 131 )
Gui, Add, ListView, x5 y5 w280 h200 grid gChangeDisplayMode, |width|height|quality (bits)|frequency (Hz)
Gui, Show, x50 y50 w290 h210, Change Display Mode
LV_SetImageList( id_image_list, 1 )
Gui, +LastFound
struct_devicemode_size = 156
VarSetCapacity( device_mode, struct_devicemode_size, 0 )
EncodeInteger( struct_devicemode_size, 2, &device_mode, 36 )
; ENUM_CURRENT_SETTINGS
success := DllCall( "EnumDisplaySettings", "uint", 0, "uint", -1, "uint", &device_mode )
current?width := DecodeInteger( "uint4", &device_mode, 108, false )
current?height := DecodeInteger( "uint4", &device_mode, 112, false )
current?quality := DecodeInteger( "uint4", &device_mode, 104, false )
current?frequency := DecodeInteger( "uint4", &device_mode, 120, false )
loop,
{
   success := DllCall( "EnumDisplaySettings", "uint", 0, "uint", A_Index-1, "uint", &device_mode )
   if ( ErrorLevel or !success )
      break
     
   mode?width := DecodeInteger( "uint4", &device_mode, 108, false )
   mode?height := DecodeInteger( "uint4", &device_mode, 112, false )
   mode?quality := DecodeInteger( "uint4", &device_mode, 104, false )
   mode?frequency := DecodeInteger( "uint4", &device_mode, 120, false )
  
   if ( mode?width = current?width
         and mode?height = current?height
         and mode?quality = current?quality
         and mode?frequency = current?frequency )
      options = Focus Icon1 Select
   else
      options = Icon0
  
   LV_Add( options, "", mode?width, mode?height, mode?quality, mode?frequency )
}
loop, 5
   LV_ModifyCol( A_Index, "AutoHdr Integer" )
LV_ModifyCol( 2, "Sort" )
current?index := LV_GetNext()
; LVM_ENSUREVISIBLE
SendMessage, 0x1000+19, current?index-1, false, SysListView321
return
GuiClose:
ExitApp
ChangeDisplayMode:
   if ( A_GuiEvent != "DoubleClick" )
      return
   ; DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT|DM_DISPLAYFREQUENCY
   EncodeInteger( 0x00040000|0x00080000|0x00100000|0x00400000, 4, &device_mode, 40 )
  
   LV_GetText( value, A_EventInfo, 4 )
      EncodeInteger( value, 4, &device_mode, 104 )
   LV_GetText( value, A_EventInfo, 2 )
      EncodeInteger( value, 4, &device_mode, 108 )
   LV_GetText( value, A_EventInfo, 3 )
      EncodeInteger( value, 4, &device_mode, 112 )
   LV_GetText( value, A_EventInfo, 5 )
      EncodeInteger( value, 4, &device_mode, 120 )
   ; 0 = change mode dynamically
   ; 2 = test if mode is valid
   ; 1 = 0+update user profile in registry
   result := DllCall( "ChangeDisplaySettings", "uint", &device_mode, "uint", 0 )
   if ( ErrorLevel )
      MsgBox, [ChangeDisplaySettings] failure: EL = %ErrorLevel%
   else
   {
      if ( result = 0 )
      {
         LV_Modify( current?index, "Icon0" )
         current?index := A_EventInfo
            LV_Modify( current?index, "Icon1" )
     
         result = DISP_CHANGE_SUCCESSFUL
      }
      else if ( result = 1 )
         result = DISP_CHANGE_RESTART
      else if ( result = -1 )
         result = DISP_CHANGE_FAILED
      else if ( result = -2 )
         result = DISP_CHANGE_BADMODE
      else if ( result = -3 )
         result = DISP_CHANGE_NOTUPDATED
      else if ( result = -4 )
         result = DISP_CHANGE_BADFLAGS
      else if ( result = -5 )
         result = DISP_CHANGE_BADPARAM
      else if ( result = -6 )
         result = DISP_CHANGE_BADDUALVIEW
     
      MsgBox, 0, Change Display Mode, %result%, 2
   }
return
DecodeInteger( p_type, p_address, p_offset, p_hex=true )
{
   old_FormatInteger := A_FormatInteger
   if ( p_hex )
      SetFormat, Integer, hex
   else
      SetFormat, Integer, dec
   sign := InStr( p_type, "u", false )^1
   StringRight, size, p_type, 1
   loop, %size%
      value += ( *( ( p_address+p_offset )+( A_Index-1 ) ) << ( 8*( A_Index-1 ) ) )
   if ( sign and size <= 4 and *( p_address+p_offset+( size-1 ) ) & 0x80 )
      value := -( ( ~value+1 ) & ( ( 2**( 8*size ) )-1 ) )
   SetFormat, Integer, %old_FormatInteger%
   return, value
}
EncodeInteger( p_value, p_size, p_address, p_offset )
{
   loop, %p_size%
      DllCall( "RtlFillMemory"
         , "uint", p_address+p_offset+A_Index-1
         , "uint", 1
         , "uchar", ( p_value >> ( 8*( A_Index-1 ) ) ) & 0xFF )
}

2016. 2. 24.

시스템 예약 종료 재시작

Gui, Add, DropDownList, x16 y32 w130 h60 AltSubmit vDDLA, 시스템 종료||다시 시작
Gui, Add, Checkbox, x81 y9 w70 h20 vCB, 강제종료
Gui, Add, DropDownList, x16 y62 w40 h90 vDDLB, 00||01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24
Gui, Add, Text, x56 y67 w30 h20 , 시간
Gui, Add, DropDownList, x86 y62 w40 h90 vDDLC, 00||01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59
Gui, Add, Text, x126 y67 w20 h20 , 분
Gui, Add, Button, x16 y122 w60 h20 g시작, 시작
Gui, Add, Button, x86 y122 w60 h20 g정지, 정지
Gui, Add, Edit, x16 y92 w130 h20 vEdit, 메세지(127자)
Gui, Add, Text, x6 y12 w70 h20 , 종료 타이머
Gui, Show, x258 y183 h186 w164, 종료타이머
Return
시작:
Gui,Submit,NoHide
Time:=DDLB*3600+DDLC*60
Code:= DDLA=1 ? "-s":"-r"
Force:= CB=1 ? "-f":""
Run,Shutdown %Code% %Force% -t %Time% -c %Edit%
Return
정지:
Run,Shutdown -a
Return
GuiClose:
ExitApp

2016. 2. 18.

마우스,키보드입력이 1분간 없을때 강제 재부팅

#Persistent

SetTimer, NoSleep, 1000

Return

NoSleep:

 if A_TimeIdlePhysical>60000

 Shutdown,6

Return