Programming > Problems & Solutions

TopMost Window

(1/3) > >>

Nicola:
Hi.
I wanted a form that is always visible, above any other, always.
I was betting like this, but it didn't work for me.
WS_EX_TOPMOST did not give the desired result.
Help please ...  :)


--- Code: ---uses WINUTIL
MainWindow 271,133,WS_SYSMENU | WS_MINIMIZEBOX | WS_EX_TOPMOST


--- End code ---

JRS:
Dialog Windows

Zlatko Vid's Solution

Charles Pegge:
A run-time solution: WM_SIZE is always called after the main window is created.


--- Code: ---  case WM_SIZE
 
  'https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowpos
  sys hw=-1 'HWND_TOPMOST 'hw must be sys as a window handle
  SetWindowPos(hwnd,hw,0,0,0,0,0x3)

--- End code ---

Nicola:
Hi Charles.
Thank you. You are very precious.
I searched the various files and found this: % HWND_TOPMOST = -1

and then using the command:  SetWindowPos (hWin, HWND_TOPMOST ...

Then I saw you wrote your post ... and I was glad I figured out how. But I put the command in WM_CREATE and it seems to be fine.
One question: what does the last parameter, 0x3, mean?
Greetings

Brian Alvarez:
I think 0x3 is hexadecimal for decimal 3, perhaps Charles used it because hexadecimals are interpreted as sys? maybe.

 Charles, would this work too?


--- Code: ---case WM_SIZE
    SetWindowPos(hwnd, sys -1,0,0,0,0, sys 3)
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version