Re: user defined WM_ question: update
Curt Hagenlocher <[email protected]>
| Newsgroups | gmane.comp.windows.off-topic |
|---|---|
| Message-ID | <[email protected]> |
I imagine you still need some kind of listener for the "targeted event". Your listener could then use PostMessage(WM_MYEVENT, 0, 0) to tell the UI thread that the event has happened. You haven't provided any specific information about the "targeted event", though -- for all I know, it's got a specialized API to do exactly what you want. On Mon, Aug 24, 2009 at 2:00 PM, Eric Strain <eric_strain1-/[email protected]> wrote: > > > OK, I got the WM_USER code to work, now is it possible to get the event > handler to fire automatically? I really don't want to use polling, even if > it is on a separate thread. Currently I have the WM_USER event being > triggered through SendMessage(WM_MYEVENT,0,0); inside an OnClicked( ) > handler attached to a UI button. Although this is working in my test app, I > want the event to be fired automatically by the OS when the targeted event > occurs. > > Any ideas? Thanks guys. > > -Eric > > --- On *Sun, 8/23/09, Eric Strain <eric_strain1-/[email protected]>* wrote: > > > From: Eric Strain <eric_strain1-/[email protected]> > Subject: [OT] user defined WM_ question > To: [email protected] > Date: Sunday, August 23, 2009, 5:17 PM > > > > Hi All, > I have a function that I need to fire when a specific event occurs. The > event that I need to trap is a network failure of any kind. I have the code > that detects when a network failure has occurred but at present the function > is inside a command line interface program and I want to transfer that > function into an MFC app and have the function activated by a WM_ event. My > question is, is it possible to get the user defined WM_ to fire > automatically, or does the user have to send the event message manually, > such as by clicking a UI button or something? > > Also, I considered using WM_USER to define the custom WM_ message, but my > research indicates that WM_APP is the preferred method for defining a custom > message. Any thoughts on this? Even better, any concrete examples? ; ) > I've looked all over the net and through my library of books with no luck. > It's a shame a person can't loose weight by running in circles, because I > seem to be getting nowhere fast. Thanks guys. > > -Eric > > > > > > >