Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a multithread program and when postmessage(hwnd,wparam,lparam) to dialog in mfc,my program hang and when keep a breakpoint my program don't hang.
Posted

There is not enough information in your question to tell. You will need to gather clues to try to get closer and pin it down.

As a first step, try running your program under the debugger but without breakpoints (as you say it doesn't exhibit the problem when there is a breakpoint). Then when it hangs, you can break the program from the debugger window And try to see where it is executing. This may give you a clue.

You didn't indicate where you where trying a breakpoint. Have you tried various places in the code that should be processing your posted message?

Have you examined the code that processes your posted message in your UI thread and the code after you post your message in your worker thread for potential thread synchronization issues? Perhaps some sort of race condition?
 
Share this answer
 
It's impossible to answer your query with the information you've given.

Is there a handler for the message being posted? If so, what does it do? Have you verified that this method doesn't hang?
 
Share this answer
 
PostMessage does not have the signature that you have mentioned.

It is either
BOOL PostMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);

Or
BOOL PostMessage(UINT message, WPARAM wParam = 0, LPARAM lParam = 0);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900