| Phiru (84) | |
|
Hi. My program has two dialogs, main and sub. Once i click a button, sub dlg will be shown up. Here is code. :OnABtnClicked(...) SubDlg dlg; dlg.doModal(); ... } I want the sub dlg to be on TOP_MOST of all windows on the desk top. So, I did like this, CRect rt; dlg.getWindowRect(rt); ::SendMessaage(dlg.GetSafeHwnd(), HWND_TOPMOST, rt.left, rt.top, rt.width(), rt.height()); However, it didn't work. I mean, the sendmessage might not work. What's the problem?? When I sendMessage with main Dlg, it works. Any Idea? | |
|
|
|
| webJose (2947) | |
|
You don't use SendMessage() for that. I guess you mixed up. I guess you meant SetWindowPos(): http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545(v=vs.85).aspx . You have to do the call to SetWindowPos() AFTER the dialog box window has been created (so you can get a handle, but BEFORE you enter the modal loop. I guess the best place would be during initialization? This looks like MFC, so see of that works for you. | |
|
|
|
| Phiru (84) | |
|
You sound like not possible for the dialog to be on top of Windows by using SendMessage(). So, I need to call SetWindowsPos() after creatin dialog box. Thank you, webJose. | |
|
|
|