Click here to Skip to main content
15,913,944 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralQuestion about GetDlgCode... Pin
15-Mar-01 12:03
suss15-Mar-01 12:03 
GeneralSolving Differential Equation Pin
15-Mar-01 8:44
suss15-Mar-01 8:44 
GeneralRe: Solving Differential Equation Pin
15-Mar-01 9:02
suss15-Mar-01 9:02 
GeneralAccess to function in CmyappDoc class AND static CList Pin
Svein Ravndal15-Mar-01 8:15
Svein Ravndal15-Mar-01 8:15 
QuestionRead data from COM port or Driver??? Pin
Richard Cheng15-Mar-01 8:13
Richard Cheng15-Mar-01 8:13 
AnswerRe: Read data from COM port or Driver??? Pin
Erik Funkenbusch15-Mar-01 11:32
Erik Funkenbusch15-Mar-01 11:32 
AnswerRe: Read data from COM port or Driver??? Pin
Tim Deveaux15-Mar-01 11:34
Tim Deveaux15-Mar-01 11:34 
AnswerRe: Read data from COM port or Driver??? (again) Pin
Tim Deveaux15-Mar-01 13:58
Tim Deveaux15-Mar-01 13:58 
Hmmm - maybe I misunderstood - you are wondering how to trap a windows message that MFC does not recognize in the class wizard etc - i.e. not a standard windows message.

You can use the message map macros - there are several, like ON_MESSAGE, ON_COMMAND, etc. They presuppose functions with particular signatures, so read the docs on these.

For example, I have a class that changes state - and it is separate from a dialog that needs to be updated when the state changes. Instead of making the class 'know' about the dialog, I define a new message that the class can send, and handle it in the dialog by adding a handler and a message map macro.

I use the ON_MESSAGE macro here:

BEGIN_MESSAGE_MAP(COPCSim1Dlg, CDialog)
    //{{AFX_MSG_MAP(COPCSim1Dlg)
    ON_WM_SYSCOMMAND()
    ON_WM_PAINT()
    /* ... */
    //}}AFX_MSG_MAP
 
    // this is the new one - keep it out of the wizard block above...
    ON_MESSAGE(WM_STATUSCHANGE, OnStatusChange)  
 
END_MESSAGE_MAP()


Then define your handler according to what the macro expects - in this case:

afx_msg LRESULT OnStatusChange(WPARAM, LPARAM);


When something changes, I let the dialog know with PostMessage:

PostMessage(theApp.m_pMainWnd->m_hWnd, WM_STATUSCHANGE, 0, SESSION_CLOSED);


In your case, you'll need to read the docs I guess to figure out what macro you can use. I'm assuming that the driver puts the message in the systems raw input thread and it gets to your window without you having to subscribe to it - and it may even be a standard message with the ERROR TOUCH as one of the parameters by the time it gets to your app - again, you'll need to read the docs. But thought this might help.

For testing, you can add code to PretranslateMessage or DefWindowProc to see if the message is getting through. The macros are a bit more MFC like, and you don't need Class Wizard to use them.
GeneralProblem refreshing CListCtrl display Pin
Ken Thomas15-Mar-01 7:12
Ken Thomas15-Mar-01 7:12 
GeneralAdding a button next to... Pin
15-Mar-01 3:18
suss15-Mar-01 3:18 
GeneralRe: Adding a button next to... Pin
l a u r e n15-Mar-01 23:22
l a u r e n15-Mar-01 23:22 
QuestionHow gethostbyname() getting hostent information? Pin
Koteswara Rao Perumalla15-Mar-01 2:25
Koteswara Rao Perumalla15-Mar-01 2:25 
AnswerRe: How gethostbyname() getting hostent information? Pin
Erik Funkenbusch15-Mar-01 11:34
Erik Funkenbusch15-Mar-01 11:34 
GeneralRe: How gethostbyname() getting hostent information? Pin
2-May-01 22:27
suss2-May-01 22:27 
GeneralRegarding global variables in COM Pin
15-Mar-01 1:55
suss15-Mar-01 1:55 
GeneralRegarding global variables in COM Pin
15-Mar-01 1:55
suss15-Mar-01 1:55 
GeneralRegarding global variables in COM Pin
15-Mar-01 1:55
suss15-Mar-01 1:55 
GeneralRe: Regarding global variables in COM Pin
Erik Funkenbusch15-Mar-01 11:36
Erik Funkenbusch15-Mar-01 11:36 
GeneralRe: Regarding global variables in COM Pin
22-Mar-01 17:21
suss22-Mar-01 17:21 
GeneralRe: Regarding global variables in COM Pin
22-Mar-01 17:24
suss22-Mar-01 17:24 
Generalinterface Pin
15-Mar-01 0:44
suss15-Mar-01 0:44 
GeneralRe: interface Pin
Erik Thompson15-Mar-01 7:44
sitebuilderErik Thompson15-Mar-01 7:44 
GeneralMenu and CPropertySheet Pin
14-Mar-01 22:44
suss14-Mar-01 22:44 
GeneralTricky Dialog... Pin
Manfred Ramosch14-Mar-01 22:04
Manfred Ramosch14-Mar-01 22:04 
GeneralRe: Tricky Dialog... Pin
James R. Twine15-Mar-01 5:33
James R. Twine15-Mar-01 5:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.