Click here to Skip to main content
15,905,563 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralClipboard copy Pin
Member 60749-Apr-04 20:32
Member 60749-Apr-04 20:32 
GeneralRe: Clipboard copy Pin
ThatsAlok9-Apr-04 23:43
ThatsAlok9-Apr-04 23:43 
GeneralFormating output file Pin
picasso29-Apr-04 19:28
picasso29-Apr-04 19:28 
GeneralRe: Formating output file Pin
Prakash Nadar9-Apr-04 19:51
Prakash Nadar9-Apr-04 19:51 
QuestionActive Window? Pin
David Horner9-Apr-04 18:54
David Horner9-Apr-04 18:54 
AnswerRe: Active Window? Pin
wuxianzhong9-Apr-04 21:26
wuxianzhong9-Apr-04 21:26 
Questionwhen to use "AFX_IDP_COMMAND_FAILURE"? Pin
vividtang9-Apr-04 18:03
vividtang9-Apr-04 18:03 
GeneralPostMessage Pin
sschilachi9-Apr-04 13:32
sschilachi9-Apr-04 13:32 
I have a function that responds to a message by incrementing a counter variable by 1:

OnAction(WPARAM wParam, LPARAM lParam)<br />
{<br />
m_nCounter += 1;<br />
}


The message that it responds to is posted twice using PostMessage, once immediately after the other (like so):

::PostMessage(GetSafeHwnd(),WM_ACTION,0,0);<br />
::PostMessage(GetSafeHwnd(),WM_ACTION,0,0);<br />


The strange thing is that if i modify the function to display a MessageBox with the value of the counter (like so):

OnAction(WPARAM wParam, LPARAM lParam)<br />
{<br />
CString string;<br />
m_nCounter += 1;<br />
string.Format("%d",m_nCounter);<br />
MessageBox(string);<br />
}


I get two message boxes, as I should; however the values in the message boxes are 2 then 1, not 1 then 2.

Howcome I am receiving 2 then 1, rather than 1 then 2 from the message boxes as you would expect?

Any help would be greatly appreciated.

Thanks
GeneralRe: PostMessage Pin
Prakash Nadar9-Apr-04 15:13
Prakash Nadar9-Apr-04 15:13 
GeneralRe: PostMessage Pin
Empty198110-Apr-04 1:19
Empty198110-Apr-04 1:19 
QuestionEXE Header Info? Pin
Timothy Grabrian9-Apr-04 12:46
professionalTimothy Grabrian9-Apr-04 12:46 
GeneralSplitting an Integer into 4 Bytes Pin
sschilachi9-Apr-04 12:16
sschilachi9-Apr-04 12:16 
GeneralRe: Splitting an Integer into 4 Bytes Pin
PJ Arends9-Apr-04 12:41
professionalPJ Arends9-Apr-04 12:41 
GeneralRe: Splitting an Integer into 4 Bytes Pin
Roman Nurik9-Apr-04 12:50
Roman Nurik9-Apr-04 12:50 
GeneralRe: Splitting an Integer into 4 Bytes Pin
grigsoft9-Apr-04 21:46
grigsoft9-Apr-04 21:46 
GeneralRe: Splitting an Integer into 4 Bytes Pin
Prakash Nadar9-Apr-04 22:00
Prakash Nadar9-Apr-04 22:00 
GeneralRunning my application when Windows starts Pin
Anonymous9-Apr-04 10:56
Anonymous9-Apr-04 10:56 
GeneralRe: Running my application when Windows starts Pin
Brian Olej9-Apr-04 11:09
Brian Olej9-Apr-04 11:09 
GeneralRe: Running my application when Windows starts Pin
toxcct9-Apr-04 11:14
toxcct9-Apr-04 11:14 
GeneralRe: Running my application when Windows starts Pin
Prakash Nadar9-Apr-04 15:18
Prakash Nadar9-Apr-04 15:18 
GeneralRe: Running my application when Windows starts Pin
2249179-Apr-04 19:04
2249179-Apr-04 19:04 
GeneralRe: Running my application when Windows starts Pin
Renjith Ramachandran9-Apr-04 19:38
Renjith Ramachandran9-Apr-04 19:38 
GeneralRe: Running my application when Windows starts Pin
Anonymous10-Apr-04 0:01
Anonymous10-Apr-04 0:01 
GeneralRe: Running my application when Windows starts Pin
Anonymous10-Apr-04 0:02
Anonymous10-Apr-04 0:02 
GeneralRe: Running my application when Windows starts Pin
Renjith Ramachandran10-Apr-04 0:44
Renjith Ramachandran10-Apr-04 0:44 

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.