Click here to Skip to main content
15,919,341 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can any one help me.
C++
UINT  CMyAPI::StartOpenThread(LPVOID lpVoid)
{
	CString strFuncName="MyAPI::StartOpenThread";
	
	CMyAPI *nvr= (MyAPI*)lpVoid;
                nvr->m_lValUID=nvr->someWorkMethod();
	SetEvent(nvr->m_hEvent);
              return 0;
}

long  CMyAPI::APIOpen()
{
	

	long lRet=-1;
	
     if(m_pThread==NULL)
        { 
			
			m_hEvent=CreateEvent(NULL,TRUE,FALSE,NULL);
			m_pThread=AfxBeginThread(CmyAPI::StartOpenThread,this);
			int nRet = WaitForSingleObject(m_hEvent,25000);
			ResetEvent(m_hEvent);
	                                CloseHandle(m_hEvent); 
			m_hEvent=NULL;
			m_pThread = NULL;
			lRet=m_lValUID;

                       }
	
		
	return lRet;
}

in MyAPI.h Class i Declare
            long m_lValUID;
      HANDLE m_hEvent;
  CWinThread *m_pThread;
static  UINT StartOpenThread(LPVOID lpVoid);
and initialize on Constructor
        m_lValUID=-1;
	m_pThread=NULL;
	
	m_hEvent=NULL;



the above code working in debug mode but crash in relese mode.Can any one help me.

[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 6-Sep-11 0:58am
v5
Comments
Timberbird 6-Sep-11 5:41am    
When something crashes in release mode it usually means incorrect memory operations. On which line does it crash and what's the error message?
CPallini 6-Sep-11 6:49am    
Why are you posting CMyApi::StartOpenThread code while you are calling instead CPanasonicAPI::StartOpenThread method?

1 solution

While the information you provided is not sufficient to help us help you, you might have a look at :

Surviving the Release Version[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900