Jump to content

Why this works this way buy not that way?


Recommended Posts

I use this clock, Yet another clock - AutoIt Forums, and I have modified it somewhat to fit my particulars. I have a question though.

This code works:

$hWnd = GUICreate("Clock", $width, $height, 1, 1, $WS_CAPTION, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
GUISetBkColor(0xc0c0c0)
;GUISetStyle($WS_CAPTION, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST), $hWnd)

Yet this doesn't:

$hWnd = GUICreate("Clock", $width, $height, 1, 1)
GUISetBkColor(0xc0c0c0)
GUISetStyle($WS_CAPTION, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST), $hWnd)

By 'works', I mean the TOPMOST style affects the GUI correctly in the first code, and has no effect on the GUI in the second bit of code. Since I've gotten it to work eventually, I don't really care why it doesn't do as I expect in GUISetStyle, but.. So don't waste your time to figure it out, unless you need to for some reason. However, if one can answer this off the top of their head, great.

Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

According to MSDN:

WS_EX_TOPMOST

Specifies that a window created with this style should be placed above all non-topmost windows and should stay above them, even when the window is deactivated. To add or remove this style, use the SetWindowPos function.

So you should use WinSetOnTop() or _WinAPI_SetWindowPos() to change the TopMost-style after creation.

Link to comment
Share on other sites

I feel foolish for not seeing that part of the manual. Thanks.<br><br>Edit: Oops, I didn't read the previous post clear enough. No wonder I didn't see that in the Help file. But good to know, if I or anyone else reading this thread needs it..<br>

Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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...