Posted on 1998-08-24
Having a little problem with VC++ 4.2 (&5.0) sending and receiving messages. It is probably something stupid I'm doing, but I cannot send messages to my application. I have a couple of instances.
First off, I start a timer as this->SetTimer (1, 5000, NULL); from the CMainFrame class initialization. I've tried it from a few other places, such as OnOpenDoc, but this is where it is now. This sends a message to my CMainFrame class object, and I have to put the message handlers in by hand since ClassWiz won't do it. The CView class, on the other hand, does have a ClassWiz interface which I use to put in the OnTimer handler. The problem is, the WM_TIMER message only goes to the MainFrame, and not the View class. The way it's explained in the VC++ Programmers guide, the MainFrame is supposed to pass the message on to a number of other objects, but it isn't. Is there something I need to do to get it to forward it?
I am also having the same problems sending basic messages from anywhere in my code to my application. Is there something undocumented to this? I've seen example code where they just do a PostMessage with the Main windows handle, and that's all they do. What gives? I have tried all the versions of PostMessage, using the AfxGetMainWnd() to get the Window, passing in the handle of the window, and just using the NULL parameter to supposedly send to my app, but the messages never show up. The return from the PostMessage says it did it, but Spy doesn't even see any message comming out, and the app doesn't respond in any of the class objects to the message. Any help is appreciated.