Jump to content
Sign in to follow this  

Autoit Screensaver: Get preview size

Recommended Posts

I'm trying to write a screensaver in Autoit at the moment. It works good but I have problems with the preview window in the screensaver setup screen. I already read about the command line parameters which are supplied by windows. http://support.microsoft.com/kb/182383

I also catched the command line argument /p which means that a window handle is supplied which should be the parent of the screensavers gui to display it on the preview screen. I added the supplied handle to GUI Create but it doesn't work. I think this is because I still try to make the window fullscreen and I don't care about the size of the preview screen.

So my question is how to get the size of a window by using the handle. I also could imagine that my ideas are completeley wrong and it works in a different way, so if anyone has experience with it, please help.

Share this post

Link to post
Share on other sites

Okay, I found the solution by myself. When you get the window handle from the command line argument it isn't useable as HWnd. First of all you have to convert it by calling

$hwnd = HWnd($CmdLine[2])

Then you can use the returned HWnd to call WinGetPos

$size = WinGetPos($hwnd)

Now you can use the returned values to create your GUI in the preview monitor:

$mainwindow = GUICreate("Screensaver", $size[2], $size[3], $size[0], $size[1], $WS_POPUP, $WS_EX_TOOLWINDOW, $CmdLine[2])

And continue your screensavers code . . .

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...