Click here to Skip to main content
15,917,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Why does the program crash when it enters a function? Pin
KaKa'20-Sep-06 6:43
KaKa'20-Sep-06 6:43 
QuestionHelp in conversion from C++ to VB6 Pin
Tomazas7718-Sep-06 6:33
Tomazas7718-Sep-06 6:33 
AnswerRe: Help in conversion from C++ to VB6 Pin
David Crow18-Sep-06 6:55
David Crow18-Sep-06 6:55 
GeneralRe: Help in conversion from C++ to VB6 Pin
Tomazas7719-Sep-06 6:45
Tomazas7719-Sep-06 6:45 
GeneralRe: Help in conversion from C++ to VB6 Pin
David Crow19-Sep-06 7:12
David Crow19-Sep-06 7:12 
QuestionPosting string using postmessage() function Pin
priyank_ldce18-Sep-06 5:08
priyank_ldce18-Sep-06 5:08 
QuestionRe: Posting string using postmessage() function Pin
David Crow18-Sep-06 5:21
David Crow18-Sep-06 5:21 
AnswerRe: Posting string using postmessage() function Pin
Zac Howland18-Sep-06 5:33
Zac Howland18-Sep-06 5:33 
Since you posted no code, I'm guessing here ...

But it sounds like you are using a CString object and passing it to PostMessage:

{
	CString strMyData = "Junk";
	PostMessage(SomeHwnd, SomeMsg, (LPARAM)(LPCTSTR)strMyData, 0);
}


This won't work since when the CString goes out of scope, it is cleaned up. Thus, when your window gets the message, the pointer to the memory is no longer valid for that string.

Is there some reason you are using PostMessage instead of SendMessage? If you are able to switch (generally, PostMessage is used in applications that need to be redesigned/refactored), the code will work, so long as you make a copy of the LPCTSTR in the handler receiving the message.

If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac

AnswerRe: Posting string using postmessage() function Pin
Nish Nishant18-Sep-06 5:55
sitebuilderNish Nishant18-Sep-06 5:55 
AnswerRe: Posting string using postmessage() function Pin
tanvon malik18-Sep-06 6:38
tanvon malik18-Sep-06 6:38 
GeneralRe: Posting string using postmessage() function Pin
ThatsAlok18-Sep-06 18:51
ThatsAlok18-Sep-06 18:51 
AnswerRe: Posting string using postmessage() function Pin
Mohammad A Gdeisat18-Sep-06 7:26
Mohammad A Gdeisat18-Sep-06 7:26 
AnswerRe: Posting string using postmessage() function Pin
Jun Du18-Sep-06 8:06
Jun Du18-Sep-06 8:06 
GeneralRe: Posting string using postmessage() function Pin
ThatsAlok18-Sep-06 18:48
ThatsAlok18-Sep-06 18:48 
GeneralRe: Posting string using postmessage() function Pin
Jun Du19-Sep-06 15:58
Jun Du19-Sep-06 15:58 
QuestionRe: Posting string using postmessage() function Pin
priyank_ldce20-Sep-06 1:25
priyank_ldce20-Sep-06 1:25 
QuestionPosting string using postmessage() function Pin
priyank_ldce19-Sep-06 1:27
priyank_ldce19-Sep-06 1:27 
QuestionWMI performance counters Pin
Jim Crafton18-Sep-06 4:54
Jim Crafton18-Sep-06 4:54 
QuestionSingle instance Pin
Waldermort18-Sep-06 4:41
Waldermort18-Sep-06 4:41 
AnswerRe: Single instance Pin
_AnsHUMAN_ 18-Sep-06 4:52
_AnsHUMAN_ 18-Sep-06 4:52 
GeneralRe: Single instance Pin
Waldermort18-Sep-06 4:57
Waldermort18-Sep-06 4:57 
GeneralRe: Single instance Pin
ThatsAlok18-Sep-06 5:05
ThatsAlok18-Sep-06 5:05 
GeneralRe: Single instance Pin
Waldermort18-Sep-06 5:35
Waldermort18-Sep-06 5:35 
GeneralRe: Single instance Pin
toxcct18-Sep-06 5:12
toxcct18-Sep-06 5:12 
AnswerRe: Single instance Pin
led mike18-Sep-06 5:27
led mike18-Sep-06 5:27 

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.