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

C / C++ / MFC

 
GeneralRe: Starting with C++ Pin
steffw14-May-07 20:54
steffw14-May-07 20:54 
GeneralRe: Starting with C++ Pin
Hamid_RT14-May-07 22:18
Hamid_RT14-May-07 22:18 
QuestionHow do I add a bitmap to a MENU Pin
jannathali13-May-07 22:35
jannathali13-May-07 22:35 
AnswerRe: How do I add a bitmap to a MENU Pin
_AnsHUMAN_ 13-May-07 22:51
_AnsHUMAN_ 13-May-07 22:51 
AnswerRe: How do I add a bitmap to a MENU Pin
Avadhut_Computer14-May-07 1:29
Avadhut_Computer14-May-07 1:29 
GeneralRe: How do I add a bitmap to a MENU Pin
Hamid_RT14-May-07 6:23
Hamid_RT14-May-07 6:23 
AnswerRe: How do I add a bitmap to a MENU Pin
Hamid_RT14-May-07 6:23
Hamid_RT14-May-07 6:23 
QuestionThread and PostMessage and Pointer Pin
AkiraOne13-May-07 22:35
AkiraOne13-May-07 22:35 
Hi All!

I have a Working Thread that send a message to the application by ::PostMessage, in parameter WPARAM a put it a pointer to a new class instace:

SEND CODE

UINT CServerSocket::ThreadPipe(LPVOID pParam)
{
.
.
.
while(*bContinue) {

EnterCriticalSection(&m_csPipeMsg);

.
.
.
pManageEventCommandData = new CGeneralData();

pManageEventCommandData->SetSocketAddress(*pSocketAddress);
pManageEventCommandData->SetEvent(EventQCDReceiveSocketACK);
::PostMessage(aHwnd,WM_USER_MANAGE_EVENT_COMMAND,(WPARAM)pManageEventCommandData,(LPARAM)0);
.
.
.

LeaveCriticalSection(&m_csPipeMsg);

::Sleep(200);
}
.
.
.	
}


RECEIVE CODE

When I receive message the class instance is delete

LRESULT CMainFrame::OnManageEventCommand(WPARAM wParam, LPARAM lParam)
{
   int nManageEventResult;
   CString sMessage;

   // Puntatore dati generali
   CGeneralData* pManageEventCommandData= reinterpret_cast<CGeneralData*>(wParam);
   if( pManageEventCommandData == NULL )
      return 0;
	
    //<< Do somethings	>> 


   if( pManageEventCommandData != NULL ) {
      delete pManageEventCommandData;
      pManageEventCommandData = NULL;
   }

   return 0;
}


This work fine, but the problem is......sometimes when I close the application I see memoryleaks,
I think that the problem is legacy to the fact that the PostMessage does not come received and the class remains allotted...but I not sure...

Any Idea D'Oh! | :doh:

Thanks in advance Smile | :)




Too many plans make the health badly!!

AnswerRe: Thread and PostMessage and Pointer Pin
Arman S.14-May-07 0:05
Arman S.14-May-07 0:05 
GeneralRe: Thread and PostMessage and Pointer Pin
AkiraOne14-May-07 1:52
AkiraOne14-May-07 1:52 
AnswerRe: Thread and PostMessage and Pointer Pin
JudyL_MD14-May-07 2:24
JudyL_MD14-May-07 2:24 
GeneralRe: Thread and PostMessage and Pointer Pin
AkiraOne14-May-07 3:37
AkiraOne14-May-07 3:37 
QuestionMCP in vc++ Pin
vikas198213-May-07 22:03
vikas198213-May-07 22:03 
AnswerRe: MCP in vc++ Pin
prasad_som13-May-07 22:43
prasad_som13-May-07 22:43 
JokeRe: MCP in vc++ Pin
Rajesh R Subramanian13-May-07 23:13
professionalRajesh R Subramanian13-May-07 23:13 
GeneralRe: MCP in vc++ Pin
prasad_som13-May-07 23:23
prasad_som13-May-07 23:23 
GeneralRe: MCP in vc++ [modified] Pin
vikas198213-May-07 23:37
vikas198213-May-07 23:37 
GeneralRe: MCP in vc++ Pin
prasad_som13-May-07 23:47
prasad_som13-May-07 23:47 
GeneralRe: MCP in vc++ Pin
vikas198214-May-07 0:01
vikas198214-May-07 0:01 
GeneralRe: MCP in vc++ Pin
vijay_aroli13-May-07 23:57
vijay_aroli13-May-07 23:57 
GeneralRe: MCP in vc++ Pin
Rajesh R Subramanian14-May-07 6:49
professionalRajesh R Subramanian14-May-07 6:49 
GeneralRe: MCP in vc++ Pin
Mark Salsbery14-May-07 6:53
Mark Salsbery14-May-07 6:53 
GeneralRe: MCP in vc++ Pin
Rajesh R Subramanian14-May-07 6:57
professionalRajesh R Subramanian14-May-07 6:57 
GeneralRe: MCP in vc++ Pin
vikas198214-May-07 8:00
vikas198214-May-07 8:00 
GeneralRe: MCP in vc++ Pin
Rajesh R Subramanian15-May-07 6:52
professionalRajesh R Subramanian15-May-07 6:52 

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.