• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • Last Modified:

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
0
SrinivasaRao
Asked:
SrinivasaRao
  • 3
  • 2
1 Solution
 
migelCommented:
Hi!
Can you show declaration of the CustomMessage handler int the dialog class?
0
 
SrinivasaRaoAuthor Commented:
hi,

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

I am using vc++ 6.0

bsr
0
 
migelCommented:
Hi!
try remove CALLBACK modifiers for your handler
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
AlexNekCommented:
2 SrinivasaRao
Did you try
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
at the function begin

0
 
SrinivasaRaoAuthor Commented:
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
0
 
migelCommented:
it is just stack corruption
try redeclare your method as
afx_msg LRESULT FunctionName(WPARAM wParam, LPARAM lParam);
and rebuild all
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now