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

C / C++ / MFC

 
Generalwriting data to a file Pin
10-Mar-01 16:50
suss10-Mar-01 16:50 
GeneralRe: writing data to a file Pin
l a u r e n11-Mar-01 2:45
l a u r e n11-Mar-01 2:45 
Generalwriting data to a file Pin
10-Mar-01 16:50
suss10-Mar-01 16:50 
Generalwriting data to a file Pin
10-Mar-01 16:47
suss10-Mar-01 16:47 
Generalwriting data to a file Pin
10-Mar-01 10:05
suss10-Mar-01 10:05 
GeneralCalling CWnd function between 2 dialogs Pin
Vickie10-Mar-01 9:26
Vickie10-Mar-01 9:26 
GeneralRe: Calling CWnd function between 2 dialogs Pin
Michael Dunn10-Mar-01 10:05
sitebuilderMichael Dunn10-Mar-01 10:05 
GeneralMessage Pump Mechanism Pin
10-Mar-01 4:48
suss10-Mar-01 4:48 
QUESTION on message pumping:

I have posted this a while back. But I hope to confirm my understanding is correct:

QUESTION 1:
What generates the BN_CLICKED message when a user click a mouse button over a button? Is the following description correct?

1. The user clicks a mouse button.

2. The mouse driver puts an item into the system input queue.

3. A system thread, which handles user input, retrieves this item and, using coordinates recorded by the driver, determines to which window this message
should be posted. Mouse messages are always sent to the window under the cursor (unless another window has captured mouse input).

Given the window handle the system detemines the thread to which this window belongs and posts WM_LBUTTONDOWN and WM_LBUTTONUP messages to the
message queue of this thread. Note, the message is posted to only one message queue since the system knowns to which thread the window belongs.

4. The application object, derived from CWinApp, will pickup the message from its thread message queue. Then route this message to the appropriate controls/windows.

5. Button window procedure receives WM_LBUTTONUP message and do the following:
(i) update the display of the button (depressed state and then the release state.)

//QUESTION: SendMessage( ) OR PostMessage( )??
(ii) sends WM_COMMAND/BN_CLICKED notification to "the parent window" or a "particular" control.
(iii) posts WM_COMMAND/BN_CLICKED notification to the application/thread message queue

6. Message map can be "expanded" to a subroutine that searches the message map upon reciept of a message/notification, then route the message to "appropriate" message handler in response a mapped message.
(This brings up the issue of message routing. ie. Things like searching the view class maps, then the document class, then the frame windows, then the app...)

QUESTION 2:
Quote from MSDN:

[OPEN QUOTE]
"This message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated.

WM_COMMAND wNotifyCode = HIWORD(wParam); (EXAMPLE: BN_CLICKED??)
wID = LOWORD(wParam);
hwndCtl = (HWND) lParam; (WHY DO U NEED HANDLE WHEN CONTROL IDENTIFIER IS PROVIDED - wID ??)
"
[CLOSE QUOTE]

(1) When a button is clicked, is a WM_MESSAGE sent (or posts) to its parent window? or to its parent window's message queue? or to its parent's window procedure?
(2) Which parent? Immediate or top level in the hierachy?
(3) When a button is clicked, is a WM_MESSAGE (with BN_CLICKED as wParam) sent or is a BN_CLICKED messages sent?
(4) Does "notification" messages and "messages" refer to the same thing?

Thanks.






GeneralRe: Message Pump Mechanism Pin
Tim Deveaux10-Mar-01 6:33
Tim Deveaux10-Mar-01 6:33 
GeneralCheck sign ... Pin
Hadi Rezaee10-Mar-01 0:56
Hadi Rezaee10-Mar-01 0:56 
GeneralRe: Check sign ... Pin
Christian Graus10-Mar-01 1:57
protectorChristian Graus10-Mar-01 1:57 
GeneralCheck sign ... Pin
Hadi Rezaee10-Mar-01 0:53
Hadi Rezaee10-Mar-01 0:53 
GeneralCheck sign ... Pin
Hadi Rezaee10-Mar-01 0:51
Hadi Rezaee10-Mar-01 0:51 
Generalaudio problems Pin
Ruth Farmery9-Mar-01 20:55
Ruth Farmery9-Mar-01 20:55 
GeneralLinking resource problem Pin
9-Mar-01 20:49
suss9-Mar-01 20:49 
GeneralRe: Linking resource problem Pin
l a u r e n10-Mar-01 1:00
l a u r e n10-Mar-01 1:00 
GeneralRe: Linking resource problem Pin
Tim Deveaux10-Mar-01 13:26
Tim Deveaux10-Mar-01 13:26 
GeneralURGENTLY Need Help Pin
#realJSOP9-Mar-01 3:53
professional#realJSOP9-Mar-01 3:53 
GeneralRe: URGENTLY Need Help Pin
l a u r e n9-Mar-01 20:42
l a u r e n9-Mar-01 20:42 
GeneralRe: URGENTLY Need Help Pin
#realJSOP12-Mar-01 2:34
professional#realJSOP12-Mar-01 2:34 
GeneralRe: URGENTLY Need Help Pin
Tim Deveaux10-Mar-01 12:54
Tim Deveaux10-Mar-01 12:54 
GeneralRe: URGENTLY Need Help Pin
#realJSOP12-Mar-01 2:37
professional#realJSOP12-Mar-01 2:37 
GeneralRe: URGENTLY Need Help Pin
#realJSOP12-Mar-01 9:56
professional#realJSOP12-Mar-01 9:56 
GeneralDifference between ADO and ADODB Pin
8-Mar-01 22:11
suss8-Mar-01 22:11 
GeneralDifference between ADO and ADODB Pin
8-Mar-01 22:11
suss8-Mar-01 22:11 

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.