Hi all!Is there an API or something that would make a DIALOGBOX stay always on top? I have tried searching but I have found none... (Maybe because of poor searching skils).Thanks in advance!
After you've secured the window's handler (HWND) of your dialog, just call the SetWindowPos function:local rect: RECTinvoke GetWindowRect, m_hWnd, addr rectinvoke SetWindowPos, m_hWnd, HWND_TOPMOST, rect.left, rect.top, rect.right, rect.bottom, SWP_SHOWWINDOWCheers,-chris
Thanks for the quick reply!local rect: RECTinvoke GetWindowRect, hWin, addr rect; Gets the current teh screen coordinates of the dialog?invoke SetWindowPos, hWin, HWND_TOPMOST, rect.left, rect.top, rect.right, rect.bottom, SWP_SHOWWINDOW; Sets the coordinates gathered from the line above, makes dialog topmost even when deactivated, and shows the the dialog?Yes my dialog stays on top.. but, I was wondering why it becomes larger than its original size...Thanks again!
Oops, sorry:I was using SetWindowPos to reset the size as well. Add SWP_NOMOVE and SWP_NOSIZE to uFlags and set all size arguments to 0 if you want just the "top most" flag set (HWND_TOPMOST):invoke SetWindowPos, hWin, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW or SWP_NOMOVE or SWP_NOSIZEThis will do it.Note: HWND_TOPMOST is a window handle of the currently set on top most, and you are telling that SetWindowPost to "show the window on top of the current top most".Other handles are: HWND_BOTTOM, HWND_NOTOPMOST, HWND_TOPEnjoy,-chris
Nice! I got it now...
I figured that the size and location was being replaced by the values gathered from the GetWindowRect! So, since now that we are literally defining the coords and dimensions, then I could omit the GetWindowRect function right? :D
Here's my code now;
DlgProc proc uses ebx esi edi hWin:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD...
.elseif uMsg==WM_COMMAND .if wParam==IDC_BUTTON_MAIN_SET invoke SetWindowPos, hWin, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE
...
Now all i have to do is figure out how to correctly set it using checkboxes... pft!
Thanks a lot chris! This helped me a lot!