AutoHotkey Community

It is currently May 27th, 2012, 11:15 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject:
PostPosted: September 22nd, 2011, 9:01 am 
Offline

Joined: July 26th, 2006, 11:25 am
Posts: 19
SKAN wrote:
Code:
cD = 32   ; bits (quality) - you can change to suit your requirments
sW = 1440 ; pixels - you can change to suit your requirments
sH = 900  ; pixels - you can change to suit your requirments
rR = 60   ; Hz (frequency) - you can change to suit your requirments

ChangeDisplaySettings( cD, sW, sH, rR )

Return

ChangeDisplaySettings( cD, sW, sH, rR ) {
  VarSetCapacity(dM,156,0), NumPut(156,dM,36)
  DllCall( "EnumDisplaySettings", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40)
  NumPut(cD,dM,104),  NumPut(sW,dM,108),  NumPut(sH,dM,112),  NumPut(rR,dM,120)
  Return DllCall( "ChangeDisplaySettings", UInt,&dM, UInt,0 )


Does not work anymore in AHK_L Unicode.
I can't figure out the reason. IMO there is no string used in the dll call.

_________________
http://www.familie-plentz.de


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2011, 9:57 am 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
DEVMODE structure is different for unicode call.
Instead of using different versions of structure , we may simply force ANSI :

Code:
ChangeDisplaySettings( cD, sW, sH, rR ) {
  VarSetCapacity(dM,156,0), NumPut(156,dM,36)
  DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40)
  NumPut(cD,dM,104),  NumPut(sW,dM,108),  NumPut(sH,dM,112),  NumPut(rR,dM,120)
  Return DllCall( "ChangeDisplaySettingsA", UInt,&dM, UInt,0 )
}

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2011, 10:00 am 
Offline

Joined: July 26th, 2006, 11:25 am
Posts: 19
Thank you very much. Works well.

_________________
http://www.familie-plentz.de


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 15th, 2011, 11:27 am 
Hello everyone,

i'm unsing win7 OS and most of the posted codes won't work.
Generally i want to switch the frequency @ 1080p form 60Hz to 24Hz by unsing a hotkey. The code below quits/stops automatically by using the defined Hotkey.

My FullHD device is selected as the second display.

Code:
^space::
  if (x:=!x)
    ChangeDisplaySettings( (bpp:=32), (breite:=1920), (hoehe:=1080), (hZ:=60) )
  else
    ChangeDisplaySettings( (bpp:=32), (breite:=1920), (hoehe:=1080), (hZ:=24) )
Return

ChangeDisplaySettings( cD, sW, sH, rR ) {
  VarSetCapacity(dM,156,0), NumPut(156,2,&dM,36)
  DllCall( "EnumDisplaySettings", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40)
  NumPut(cD,dM,104),  NumPut(sW,dM,108),  NumPut(sH,dM,112),  NumPut(rR,dM,120)
  Return DllCall( "ChangeDisplaySettings", UInt,&dM, UInt,0 )
}


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], nomissenrojb, Rajat and 52 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group