Click here to Skip to main content
16,005,206 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: based pointer crashed my app Pin
Alex Cutovoi24-Jan-07 2:38
Alex Cutovoi24-Jan-07 2:38 
GeneralRe: based pointer crashed my app Pin
KarstenK24-Jan-07 4:37
mveKarstenK24-Jan-07 4:37 
GeneralRe: based pointer crashed my app Pin
Mark Salsbery24-Jan-07 5:54
Mark Salsbery24-Jan-07 5:54 
QuestionRe: based pointer crashed my app Pin
David Crow24-Jan-07 4:17
David Crow24-Jan-07 4:17 
AnswerRe: based pointer crashed my app Pin
Alex Cutovoi24-Jan-07 6:00
Alex Cutovoi24-Jan-07 6:00 
QuestionRe: based pointer crashed my app Pin
David Crow24-Jan-07 7:01
David Crow24-Jan-07 7:01 
AnswerRe: based pointer crashed my app Pin
Alex Cutovoi24-Jan-07 8:10
Alex Cutovoi24-Jan-07 8:10 
GeneralRe: based pointer crashed my app Pin
David Crow24-Jan-07 8:37
David Crow24-Jan-07 8:37 
Try this:

// the structure to pass around
class MyStruct 
{ 
public: 
    MyStruct()
    {
        m_pMsg = new char[128];
        lstrcpy(m_pMsg, "Hello World");
    }
 
    ~MyStruct()
    {
       delete [] m_pMsg;
       m_pMsg = NULL;
    }
  
    char *m_pMsg;
 
    void Exec( void )
    {
        AfxMessageBox(m_pMsg);
    }
};
 
// on the sending end
MyStruct myStruct;
COPYDATASTRUCT dataToSend;
     
dataToSend.cbData = sizeof(MyStruct);
dataToSend.lpData = &myStruct;
dataToSend.dwData = 0;  
 
::SendMessage(GetSafeHwnd(), WM_COPYDATA, (WPARAM) GetSafeHwnd(), (LPARAM)&dataToSend);
 
// on the receiving end
COPYDATASTRUCT *dataReceived = (COPYDATASTRUCT *)pCopyDataStruct; 
MyStruct *pStruct = (MyStruct *) dataReceived->lpData;
pStruct->Exec();



"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

"Judge not by the eye but by the heart." - Native American Proverb


AnswerRe: based pointer crashed my app Pin
Michael Dunn24-Jan-07 9:34
sitebuilderMichael Dunn24-Jan-07 9:34 
GeneralRe: based pointer crashed my app Pin
Alex Cutovoi24-Jan-07 11:40
Alex Cutovoi24-Jan-07 11:40 
GeneralRe: based pointer crashed my app Pin
Michael Dunn24-Jan-07 12:37
sitebuilderMichael Dunn24-Jan-07 12:37 
GeneralRe: based pointer crashed my app Pin
Alex Cutovoi25-Jan-07 16:34
Alex Cutovoi25-Jan-07 16:34 
QuestionComputing hashes and comparing hashes for C++ Pin
vgandhi24-Jan-07 2:05
vgandhi24-Jan-07 2:05 
AnswerRe: Computing hashes and comparing hashes for C++ Pin
James R. Twine24-Jan-07 7:28
James R. Twine24-Jan-07 7:28 
GeneralRe: Computing hashes and comparing hashes for C++ Pin
vgandhi24-Jan-07 8:09
vgandhi24-Jan-07 8:09 
GeneralRe: Computing hashes and comparing hashes for C++ Pin
James R. Twine24-Jan-07 11:14
James R. Twine24-Jan-07 11:14 
GeneralRe: Computing hashes and comparing hashes for C++ Pin
vgandhi24-Jan-07 20:35
vgandhi24-Jan-07 20:35 
AnswerRe: Computing hashes and comparing hashes for C++ Pin
Michael Dunn24-Jan-07 9:36
sitebuilderMichael Dunn24-Jan-07 9:36 
GeneralRe: Computing hashes and comparing hashes for C++ Pin
vgandhi24-Jan-07 20:29
vgandhi24-Jan-07 20:29 
GeneralRe: Computing hashes and comparing hashes for C++ Pin
Michael Dunn24-Jan-07 20:41
sitebuilderMichael Dunn24-Jan-07 20:41 
GeneralRe: Computing hashes and comparing hashes for C++ Pin
vgandhi25-Jan-07 0:30
vgandhi25-Jan-07 0:30 
AnswerRe: Computing hashes and comparing hashes for C++ Pin
El Corazon24-Jan-07 15:06
El Corazon24-Jan-07 15:06 
QuestionOnNcActivate not called in a child window Pin
Sandy Kinghorn24-Jan-07 1:23
Sandy Kinghorn24-Jan-07 1:23 
AnswerRe: OnNcActivate not called in a child window Pin
Mark Salsbery24-Jan-07 5:58
Mark Salsbery24-Jan-07 5:58 
GeneralRe: OnNcActivate not called in a child window Pin
Sandy Kinghorn24-Jan-07 6:33
Sandy Kinghorn24-Jan-07 6: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.