callback function and SendMessage.

Posted on 2003-03-28
Medium Priority
Last Modified: 2013-12-03
Here is a design of a peice of code. Let me know if this can cause a race condition or a deadlock.

I have an MFC application, which is using and linking to a MFC extension dll. In my MFC extension dll, i have a class which  holds a callback pointer of one class instance of the main MFC application. When an event is received, this callback pointer is called from the MFC extension dll new thread(second thread in dll always alive). The callback handler function in the main application does a SendMessage to one of its child windows or to itself. If the callback from the MFC extension is called multiple times, all the messages sent to a window from the callback handler are not received by that window. Is there something wrong in this?? Let me know any good solution to this kind of problems.

Question by:gadige
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
LVL 11

Accepted Solution

Agarici earned 80 total points
ID: 8240157
SendMessage waits for the message to be handled -- maybe that is the problem, so try using PostMessage instead

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

765 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