hi, how to create system modal windows or dialog boxes? with system modal i mean, that first the window or dialog must be closed before you can do anything else.
I believe with DialogBoxes you can define the system modal in the resource with DS_MODALFRAME. For Windows' tho... isn't it enough to declare the hWndParent thingy? Maybe I'm wrong, maybe not... at least I tried... :) Jimmy
what do you mean with that "hwndparent" thingy? could you explain that a bit? and it isn't enough to declare DS_MODALFRAME in the resource. this is my template:
i also tried other combinations, but nothing does work. :( cya
MyDialog DIALOG 10, 10, 205, 60 STYLE 0x0004 | DS_CENTER | WS_CAPTION | WS_VISIBLE | DS_MODALFRAME | DS_3DLOOK | DS_SYSMODAL | WS_POPUP | WS_SYSMENU
Hi Safcon, Sorry for pointing you in the wrong direction. Actually I thought it was easy but trying it showed me the opposite. Well, ok. There's only one way I found out how I could get a dialog modal so that no other message was processed by the main window while it was on screen. This of course is a sh*tty solution (and I'm not proud of it) I configured my dialog as DS_MODALFRAME (I think this is useless anyhow) but more importantly WS_CHILD (Side-effect: It can't leave your mainwindow) The I inserted a Flag before the Wndproc
Well, it does what you want! For the Window getting modal??? I dunno... maybe next time I better restrict myself before posting useless answers.. Hope this helps in some kind of way... Sorry again Jimmy
.data Flag byte 0 .code WndProc proc hWin :DWORD, uMsg :DWORD, wParam :DWORD, lParam :DWORD .while Flag!=0 return 0 .endw ... ... .if uMsg==WM_COMMAND invoke CreateDialogParam,hInstance,ADDR dialog,hWin,ADDR DialogProc,NULL .ELSEIF etc etc ... ... WndProc endp DialogProc proc hwnd:HWND, iMsg:DWORD, wParam:WPARAM, lParam:LPARAM .IF iMsg==WM_INITDIALOG mov Flag,1 .ELSEIF iMsg==WM_CLOSE mov flag,0 invoke EndDialog,hwnd,NULL .ELSE mov eax,FALSE ret .ENDIF mov eax,TRUE ret DialogProc endp
There is no such thing as system modal in Win32. Any existing (remaining) styles or functions are provided for porting compatibility from Win16.
If you need a window to stay on top, ie, even if another window is enables, it is still drawn behind the 'on top window'. call SetWindowPos and set the HWND_TOPMOST flag or something in the zOrder. I also think there might be a flags to do this in dwStyleEx or dwStyle.
Safcon, U gotta love to hear it :)
:D This message was edited by JimmyClif, on 3/13/2001 1:24:02 PM
#define DS_SYSMODAL 0x02L MyDialog DIALOG 10, 10, 205, 60 STYLE 0x0004 | DS_SYSMODAL | DS_CENTER | WS_CAPTION | WS_VISIBLE | DS_MODALFRAME | DS_3DLOOK | DS_SYSMODAL | WS_POPUP | WS_SYSMENU