Solved

user-defined message from DLL to CView

Posted on 2000-05-10
1
173 Views
Last Modified: 2013-12-03
I am sending a message from a DLL using PostThreadMessage to the main thread but I could catch the message only in CMainFrame class. But I would like to get it in CView. I tried to write the message handler in CView but it did not help. How can I do it?
0
Comment
Question by:keremcaglar
1 Comment
 
LVL 4

Accepted Solution

by:
saurabh_dasgupta earned 50 total points
ID: 2796424
PostMessage(HWND, msg ..) would have  worked fine if you want to asynchronously pass a message to a specified window.

The DLL may or may not know the window handle of the window that is encapsulated by the CView . It knows the thread id to which the message is to be posted .

In your DLL, you are doing a PostThreadMessage , and this is handled by your CMainFrame window . Since you are able to handle the message in CFrame, why not a write a message handler in CFrame to pass on this message to the CView ?

I think that , by doing the above, you will not be deviating from your original design concept of the DLL not knowning anything about the CView, and only using the threadId for posting the message.

Further , you must remember that all the messages that are posted using PostThreadMessage , have the hwnd member of the MSG structure returned from GetMessage equal to NULL.

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

786 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