Link to home
Start Free TrialLog in
Avatar of WxW
WxW

asked on

Dialogs & WS_VISIBLE

I am trying to make a dialog NOT visible , but no trick works . Removing the WS_VISIBLE from the resource file does nothing , processing WM_INITDIALOG and ShowWindow or SetWindowLong do nothing also .
Please help.
ASKER CERTIFIED SOLUTION
Avatar of nietod
nietod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nietod
nietod

Opps, above I thought you were using MFC, but I'mm not sure why.  OnInitDialog() should just be WM_INITDIALOG.

I'm not sure when you want it visible and when not, but it sounds like you want to create it invisible, right?  In that case, I would "hook" the WM_WINDOWPOSCHANGING message.  In there get a hold of the WINDOWPOS structure and then set the SWP_HIDEWINDOW bit flag of the flags member.  That will make the window invisible

Of course you will need some sort of "switch" to determine when your code should set this bit flag and when it should not.  Otherwise, the window will never be visible.

Ask if you have questions.
Avatar of WxW

ASKER

I already had in mind the "switch" trick , but I could not think that WM_WINDOWPOSCHANGING should be trapped . Why the hell Windows does not take the style from the resource ?
Thanks nietod .
It does use the style in the resource.  It creates the dialog as an invisible window, just like you requested.  However, later on (sometime after WM_INITDIALOG) it displays the dialog.