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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

postmessage() inside initdialog() crashing

Status
Not open for further replies.

Lorey

Programmer
Feb 16, 2003
88
0
0
SG
Hello experts!

I just want to know if putting a postmessage inside an initidialog is a smart idea. Because when i try to run my program, it crashes (Debug assertion failed. File: Wincore.cpp Line:890). But when I try to not use the postmessage and make it an ordinary procedure, the dialog displays without an error.

Also, can anybody point me to any docs about understanding postmessage() and sendmessage()?

Thanks!
 
Could you give us some code? I tried this and it worked.

Code:
PostMessage(WM_CLOSE,0,0);

This was placed in OnInitDialog(). The program posted the message and closed out properly when the application processed the message.


HyperEngineer
If it ain't broke, it probably needs improvement.
 
Lorey,

The PostMessage() function is documented in the MDSN Library, at also in the Platform SDK documentation. What arguments are you supplying to PostMessage()?

Good Luck,

Greg Hansen
 
PostMessage is basically stick it on the list and when it comes round to processing time, the message queue will look at it and send it to the appropriate position.

SendMessage is basically a subroutine call to the class without the class exporting its functions. This was called a jump table when I first started computing.

SendMessage does not put things in the list.

The problems that tend to happen are

1) Class A, Method B calls SendMessage on Class C, Method D
Class C, Method D calls SendMessage on Class A, Method E
Unfortunately, Method E requires something in Method B to be initialized first so crashitis.

2) Class A, Method B calls PostMessage on Class C, Method D.
It expects something to happen and then does something else. Whatever it is expecting hasn't happened because it is still in the list and the message queue has not processed it yet.

If you have to, draw out the sequencing using swim lanes. It will give you a clearer picture of what is happening.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top