Jump to content

HWid question


Recommended Posts

i have a script that bases the PixelSearch() box around the center of your screen, using @DesktopWidth and @DesktopHeight.

when i run the program i want to use this sort of script on, it seems that the program changes your desktop resolution in order for it to run in whatever resolution it uses.. is there any way i can use an HWid command to base the coordinates off of?

Link to comment
Share on other sites

So, you don't need the desktop resolution, you need the current resolution.

I think you should use a nice DllCall to GetSystemMetrics. Example thread :

http://www.autoitscript.com/forum/index.php?showtopic=97151

Except you want another piece of info, not $SM_VIRTUALWIDTH. I'm not sure which, there's so many :

http://msdn.microsoft.com/en-us/library/ms724385%28VS.85%29.aspx

EDIT: Also do a forum search for "resolution", only on thread titles.

Edited by Inverted
Link to comment
Share on other sites

well that looks great.. but how would i use the GetSystemMetric SM_CXEDGE and SM_CYEDGE in autoit? or how would i convert those two properties into the example script?

Global Const $SM_VIRTUALWIDTH = 78
    Global Const $SM_VIRTUALHEIGHT = 79
    $VirtualDesktopWidth = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH)
    $VirtualDesktopWidth = $VirtualDesktopWidth[0]
    $VirtualDesktopHeight = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT)
    $VirtualDesktopHeight = $VirtualDesktopHeight[0]

???

Link to comment
Share on other sites

I tested your script and it works fine.

Global Const $SM_VIRTUALWIDTH = 78
Global Const $SM_VIRTUALHEIGHT = 79

Sleep (10000)
$VirtualDesktopWidth = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH)
$VirtualDesktopWidth = $VirtualDesktopWidth[0]
$VirtualDesktopHeight = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT)
$VirtualDesktopHeight = $VirtualDesktopHeight[0]

MsgBox (4096, "", $VirtualDesktopWidth &"  "& $VirtualDesktopHeight)

I put a sleep there for 10 seconds, ran the script, then ran a game at a resolution different than my desktop and it returned the correct resolution. So, that's it I guess !

Edited by Inverted
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...