Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with CDialog...

Status
Not open for further replies.

robo99

Programmer
Joined
Jan 30, 2003
Messages
5
Location
US
Hi All,
It's probably easy question but I didn't find yet solution.
I need to dialog based application to run as hidden
calling ShowWindow(SW_HIDE). Its easy to call it when window is open already (e.g by pressing key)but how to
call it if I don't want to show dialog att all???
I want it to go immediately to hidden state.
in OnInitDialog() doesn't work.
thanks
 
another words: how to simulate or automate "OK" button :)
 
If you want to create a dialog that's initially invisible, it will have to be a modeless dialog. Modal dialogboxes cannot initially be invisible (regardless of whether or not you specify the WS_VISIBLE style).
Greetings,
Rick
 
I figured it out partially: I can simulate
the button click by SendMessage(..)but although
it simulates it, (action is taken as I would click
button), but the window doesn't hide. If I click normally this button it does... I call that function in OnInitDialog() like this: SendMessage(WM_COMMAND, MAKELONG(m_AutoOK.GetDlgCtrlID(), BN_CLICKED ), (LPARAM)m_hWnd);

maybe I shouldn't call it in OnInitDialog()? but where?
 
OnInitDialog is being called BEFORE the dialog will be shown. If it does not matter that the dialog is visible when you "simulate" the OK button, you can try to do this in the OnActivate message.
Greetings,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top