Link to home
Start Free TrialLog in
Avatar of SrinivasaRao
SrinivasaRao

asked on

UI thread problem

Hi
  I am creating one user interface thread, which intern creates a dialog box.This dialog box is handling windows messages like WM_TIMER, WM_CREATE very well. Problem is arising when i am sending a user defined message. Message is being posted to the dialog box and the corresponding function is executing. But in the function its showing this as NULL and hWnd as ???. I am using PostMessage() to post message. I tried with PostThreadMessage, but no result. I replaced ON_MESSAGE WITH ON_THREAD_MESSAGE, but the problem persists.

One thing I am amazing is that why cant it deals with user defined messages, when it can handle Windows messages. I hope i get some help from u.
Thank u in anticipation.

regards,
bsr
Avatar of migel
migel

Hi!
Can you show declaration of the CustomMessage handler int the dialog class?
Avatar of SrinivasaRao

ASKER

hi,

   The declaration of the handler function is :
LRESULT CALLBACK FunctionName( WPARAM, LPARAM );

I am using vc++ 6.0

bsr
Hi!
try remove CALLBACK modifiers for your handler
2 SrinivasaRao
Did you try
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
at the function begin

its working when the declaration is : afx_msg void functionname() .

But after execution of the method its throwing Access Violation Error!!!!

unable to trace the things:)

bsr
ASKER CERTIFIED SOLUTION
Avatar of migel
migel

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