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
Solved

UI thread problem

Posted on 2002-04-28
8
180 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
  • 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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 50 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Perl Awk Need Help 3 128
zeroMAx challenge 20 111
how to use laptop or pad camera in vb.net windows application 2 85
Problem to App 4 97
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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