Skip to main content
gamedev.net
🔒 Locked

post created window message

Started by Xelot 8 replies 500+ views
Original Post
Xelot
Xelot
With a MFC dialog based app, what message is sent immediatly after the dialog is created and visible? Advanced thanks
Shannon Barber
Shannon Barber
WM_INITDIALOG?
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Xelot
Xelot
That appears to happen before. I wanted after.
S1CA
S1CA
With MFC it probably differs based on which type of dialog you create (modal, modeless etc).

Best thing to do is use Spy++ (its in the "Microsoft Visual Studio 6.0 Tools" folder with this you can find the exact sequence of messages which get sent to your app!

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
Xelot
Xelot
It seems like you dont know of any window message. Mabye theres a different way to do it. What I want to do is call ::DoModal() on my ''New Document'' dialog after the main one has loaded. Like in VC++ where the ''Tip of the Day'' dialog is shown right on top of the main VC++ window right when it loads. How could I do this if there isnt a window message thats called right after main dialog loads? I could use a timer but there has to be a better way. Any ideas or is a timer good?
Kinneysr84
Kinneysr84
WM_CREATE? after the call to CDialog::onCreate()

With a timer i think you will run into problems on sloeer machines.


-Kinney






-----------------------------Steve Kinney
Xelot
Xelot
quote:
Original post by Kinneysr84
WM_CREATE? after the call to CDialog::onCreate()

With a timer i think you will run into problems on sloeer machines.


-Kinney



That doesnt work either. Heres what I did:

int CMapEditDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;

// TODO: Add your specialized creation code here
MessageBox("hello");

return 0;
}

The message box appeared before the main dialog. I want something that will happen after the main dialog. Thanks for trying. Anyone?
Shannon Barber
Shannon Barber
I''m not sure if WM_SHOWWINDOW is sent right before or right after the window is made visible... I think it may be right before.

Spy++ will tell you if there''s a message sent where you want one.


Magmai Kai Holmlor
- Not For Rent
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Stoffel
Stoffel
If you''re using MFC, you want to override the virtual function CDialog::OnInitDialog. Within that override, you have to call CDialog::OnInitDialog explicitly; this physically creates the dialog and all the objects on it. All of your HWNDs will be invalid before the base-class call to OnInitDialog, and all of the HWNDs will be valid after it. So if you want to do something when the dialog is created and visible, put it after the base-class call.
Xelot
Xelot
That did it. Thanks.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.