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

C / C++ / MFC

 
GeneralPopup Menus Pin
Marissa1821-Aug-03 17:52
Marissa1821-Aug-03 17:52 
GeneralRe: Popup Menus Pin
HPSI1-Aug-03 18:22
HPSI1-Aug-03 18:22 
GeneralRe: Popup Menus Pin
Snillet2k7-Mar-04 9:01
Snillet2k7-Mar-04 9:01 
GeneralRe: Popup Menus Pin
Anonymous2-Aug-03 0:22
Anonymous2-Aug-03 0:22 
QuestionHow to use ofstream to output muliple files, please help! Pin
tomsspc1-Aug-03 17:37
tomsspc1-Aug-03 17:37 
AnswerRe: How to use ofstream to output muliple files, please help! Pin
Michael Dunn1-Aug-03 18:25
sitebuilderMichael Dunn1-Aug-03 18:25 
GeneralRe: How to use ofstream to output muliple files, please help! Pin
Anonymous2-Aug-03 12:33
Anonymous2-Aug-03 12:33 
GeneralSendMessage and buffer question Pin
alex.barylski1-Aug-03 15:12
alex.barylski1-Aug-03 15:12 
I have used the following code, but feel uncomfortable about it, if you could make any suggestions as to how to better it, I would appreciate it.

char* pTmpBuf = new char[filename.GetLength()+1];
ZeroMemory(pTmpBuf, filename.GetLength()+1);
CopyMemory(pTmpBuf, filename, filename.GetLength());

GetParent()->SendMessage(LVN_ADDFILE, filename.GetLength(), (LONG)pTmpBuf);

delete[] pTmpBuf;


Thats the code that send the message obviously

void MyDialog::MyFunc(WPARAM wParam, LPARAM lParam)
{
  CString buff="";
  CopyMemory(buff.GetBuffer(wParam), (void*)lParam, wParam);
  AfxMessageBox(buff);
}


The main question I have...is it safe to delete the temp buffer after the message has been sent? Or should I leave deletion of the pointer to the client programmer inside MyFunc

I'm drinking triples, seeing double and acting single Cool | :cool:
GeneralRe: SendMessage and buffer question Pin
Chris Richardson1-Aug-03 15:49
Chris Richardson1-Aug-03 15:49 
GeneralRe: SendMessage and buffer question Pin
alex.barylski2-Aug-03 16:22
alex.barylski2-Aug-03 16:22 
GeneralRe: SendMessage and buffer question Pin
Michael Dunn1-Aug-03 17:03
sitebuilderMichael Dunn1-Aug-03 17:03 
GeneralCFileFind Pin
Dor1-Aug-03 15:04
Dor1-Aug-03 15:04 
GeneralRe: CFileFind Pin
HPSI1-Aug-03 18:03
HPSI1-Aug-03 18:03 
GeneralSQL server OLEDB connection with vc++ Pin
haritadala1-Aug-03 14:27
haritadala1-Aug-03 14:27 
GeneralAppWizard. Pin
WREY1-Aug-03 13:05
WREY1-Aug-03 13:05 
GeneralRe: AppWizard. Pin
Chris Richardson1-Aug-03 14:14
Chris Richardson1-Aug-03 14:14 
GeneralRe: AppWizard. Pin
Chris Richardson1-Aug-03 15:41
Chris Richardson1-Aug-03 15:41 
GeneralRe: AppWizard. Pin
WREY1-Aug-03 21:26
WREY1-Aug-03 21:26 
GeneralRe: AppWizard. Pin
WREY2-Aug-03 0:05
WREY2-Aug-03 0:05 
GeneralCFileListCtrl Pin
alex.barylski1-Aug-03 11:33
alex.barylski1-Aug-03 11:33 
QuestionThe connection with the server was reset??? Pin
ATC1-Aug-03 10:36
ATC1-Aug-03 10:36 
AnswerRe: The connection with the server was reset??? Pin
Alexander M.,1-Aug-03 12:38
Alexander M.,1-Aug-03 12:38 
GeneralRe: The connection with the server was reset??? Pin
Anders Molin1-Aug-03 12:55
professionalAnders Molin1-Aug-03 12:55 
GeneralRe: The connection with the server was reset??? Pin
ATC2-Aug-03 8:09
ATC2-Aug-03 8:09 
GeneralExtractIcon() takes long time for some files Pin
s_k1-Aug-03 10:24
s_k1-Aug-03 10:24 

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.