?
Solved

UI thread problem

Posted on 2002-04-28
8
Medium Priority
?
184 Views
Last Modified: 2013-11-20
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
Comment
Question by:SrinivasaRao
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 Comments
 
LVL 12

Expert Comment

by:migel
ID: 6974828
Hi!
Can you show declaration of the CustomMessage handler int the dialog class?
0
 

Author Comment

by:SrinivasaRao
ID: 6976274
hi,

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

I am using vc++ 6.0

bsr
0
 
LVL 12

Expert Comment

by:migel
ID: 6976524
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.

 
LVL 16

Expert Comment

by:AlexNek
ID: 6978465
2 SrinivasaRao
Did you try
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
at the function begin

0
 

Author Comment

by:SrinivasaRao
ID: 6979757
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
 
LVL 12

Accepted Solution

by:
migel earned 200 total points
ID: 6979893
it is just stack corruption
try redeclare your method as
afx_msg LRESULT FunctionName(WPARAM wParam, LPARAM lParam);
and rebuild all
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question