I have written a dialog-based application using the MASM32 package. I want the dialog to be hidden initially, only being displayed when the icon in the tray is clicked. When the dialog is displayed, the user will click on a button and it is hidden. A click on the tray icon will re-display it again as desired. This works fine. However, I cannot hide the dialog at startup. Here is the code for the WM_INITDIALOG message: .elseif uMsg==WM_INITDIALOG invoke LoadIcon,hInstance,IDR_MAINICON mov hIcon,eax invoke SetDlgItemInt,hDlg,IDC_TICKWIN,tickWindow,FALSE invoke wsprintf,ADDR txtBuf,ADDR ifTxt,tickWindow invoke AddTaskbarIcon,hDlg,1,hIcon,ADDR txtBuf invoke InstallHook,tickWindow invoke ShowWindow,hDlg,SW_HIDE invoke UpdateWindow,hDlg mov nResult,FALSE Does anyone have a suggestion? /Mike
Posted on 2001-01-27 18:12:00 by Burns
quote from the programmer's reference: "The WM_INITDIALOG message is sent to the dialog box procedure immediately before a dialog box is displayed." so you can't hide the dialog window when handling the WM_INITDIALOG message as it is not visible yet but will be shown afterwards.
Posted on 2001-01-27 18:52:00 by Tola
Even if you can't hide it, that doesn't mean it can't be seen. Create it way off screen for one. But my guess is is you define the dialog box without WS_VISIBLE, it ain't gonna be seen.
Posted on 2001-01-27 19:42:00 by Ernie
You guys are on the wrong track. It all comes down to what function you call to create the dialog. If it's DialogBoxParam, the dialog box is always visible. If you want your dialog box to be invisible at startup, use CreateDialogParam instead. If you don't specify WS_VISIBLE, your dialog box will be hidden.
Posted on 2001-01-27 20:50:00 by Iczelion