Solved

UI thread problem

Posted on 2002-04-28
8
179 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ODBC Connection Logging, ADO.NET 6 64
Generic progress indicator 6 117
Use of condition with 'serial' in ansible 2 61
Problem to event 3 97
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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 Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

778 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