Sign in to follow this  
Followers 0
demandnothing

HWid question

9 posts in this topic

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?

Share this post


Link to post
Share on other sites



I don't get it. Why don't you get the desktop resolution after the program has changed it ? So then you can find the center.

Share this post


Link to post
Share on other sites

well i've tried that and it doesnt seem to work.. the desktop resolution to the script comes as what your computer is set up to, not what the program has changed it to.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
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]

???

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

thanks a lot for your help.. how do i make sure you are acknowledged for this?

Share this post


Link to post
Share on other sites

Sacrifice a goat in my name ! :D

Share this post


Link to post
Share on other sites

done and done.. do you think you can help me with another problem? i posted a thread asking for help but the responses are coming very slowly.. how would i declare a variable as a moving object? floating variable type somebody said.. i dont really know..

Share this post


Link to post
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
Sign in to follow this  
Followers 0