Click here to Skip to main content
15,888,816 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: funny with boost::tribool Pin
Chris Meech31-Aug-12 2:16
Chris Meech31-Aug-12 2:16 
Questionhow to share data between two dlls.? Pin
mbatra3128-Aug-12 1:08
mbatra3128-Aug-12 1:08 
AnswerRe: how to share data between two dlls.? Pin
Maximilien28-Aug-12 3:06
Maximilien28-Aug-12 3:06 
GeneralRe: how to share data between two dlls.? Pin
mbatra3128-Aug-12 19:30
mbatra3128-Aug-12 19:30 
QuestionIs it possible to use std::wstring parameter type in DLL? Pin
Falconapollo27-Aug-12 23:57
Falconapollo27-Aug-12 23:57 
AnswerRe: Is it possible to use std::wstring parameter type in DLL? Pin
CPallini28-Aug-12 0:29
mveCPallini28-Aug-12 0:29 
AnswerRe: Is it possible to use std::wstring parameter type in DLL? Pin
Richard MacCutchan28-Aug-12 7:41
mveRichard MacCutchan28-Aug-12 7:41 
QuestionIPreviewHandler generate BEX error Pin
Le@rner27-Aug-12 22:19
Le@rner27-Aug-12 22:19 
hi all,

i m using IPreviewHandlerto create preview of diffrent type of files,but some application stop working and give a crash message with Event Name : BEX,

//these are declare in header(.h) file
        IPreviewHandler			*pHandle;
	IInitializeWithFile		*m_IFile;
	IInitializeWithStream	*m_IStream;
	IStream					*pStream;

/**********************************************************************/
//and before every preview i clear or release the previous handlers
//--------
//---------------------------------
	if(pHandle != NULL)
	{
		if(m_IFile!=NULL)
		{
			m_IFile->Release();
			m_IFile = NULL;
		}

		if(m_IStream!=NULL)
		{
			m_IStream->Release();
			m_IStream = NULL;
		}

		if(m_pStream != NULL)
		{
			m_pStream->Release();
			m_pStream = NULL;
		}

		pHandle->Unload();

		pHandle->Release();

		pHandle = NULL;

		CoUninitialize();
	}
	//---------------------------------
//--------
	HRESULT hres;
	WCHAR *pwcExtn = NULL;
	CString csClsid;	

	pwcExtn = StrRChr(szFile, NULL, L'.');
	csClsid = GetClsidFromExtn( pwcExtn );
	
	CLSID cls;

	pHandle = NULL;
	m_IFile = NULL;
	m_IStream = NULL;
	pStream   = NULL;
	

	if(CLSIDFromString( (LPWSTR)(LPCTSTR)csClsid,&cls) != NOERROR )
	{
		return 0;
	}
	else
	{
		CoInitialize(NULL);			

		hres = CoCreateInstance(
			cls,
			0,
			CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
			IID_IPreviewHandler,(LPVOID*)&pHandle);

	 
		if (FAILED(hres))
		{
			CoUninitialize();
			return 0;                
		}
				

		hres = pHandle->QueryInterface(IID_IInitializeWithFile,(LPVOID*)&m_IFile );

		if (FAILED(hres))
		{	
                			hres = pHandle->QueryInterface(IID_IInitializeWithStream,(LPVOID*)&m_IStream );

			if (FAILED(hres))
			{
				
				CoUninitialize();
				return 0;                 
			}

			if(CreateStreamOnHGlobal(NULL, TRUE, &pStream) == S_OK)
			{
				CFileException pError ;
				CFile picFile;
				if(picFile.Open(szFile, CFile::modeRead | CFile::typeBinary,&pError))
				{
					BYTE pBuffer[1024];
					UINT uiRead = 0;

					while((uiRead = picFile.Read(pBuffer, sizeof(pBuffer))) != 0)
					{
						ULONG ulWritten = 0;
						pStream->Write(pBuffer, uiRead, &ulWritten);
					}

					picFile.Close();
				}
				else
				{
					
					TCHAR szError[1024];
					pError.GetErrorMessage(szError, 1024);
					AfxMessageBox(szError);
					
				}
				
			}
			
			m_IStream->Initialize(pStream,STGM_READ);
		}
		else
			hres = m_IFile->Initialize(szFile,STGM_READ);

		hres = pHandle->SetWindow( hWnd , &rectPreview );
		
		pHandle->DoPreview();
		
		pHandle->SetRect(&rectPreview);
				
	}	

i really dont understand whats happning here.

please help me for this.
QuestionSending preformed UDP Packets to localhost with C++ Pin
Member 936259727-Aug-12 12:31
Member 936259727-Aug-12 12:31 
QuestionC++ : pass a string array to LPARAM Pin
Atlence27-Aug-12 6:57
Atlence27-Aug-12 6:57 
AnswerRe: C++ : pass a string array to LPARAM Pin
Richard MacCutchan27-Aug-12 7:17
mveRichard MacCutchan27-Aug-12 7:17 
GeneralRe: C++ : pass a string array to LPARAM Pin
Atlence27-Aug-12 11:07
Atlence27-Aug-12 11:07 
GeneralRe: C++ : pass a string array to LPARAM Pin
Richard MacCutchan27-Aug-12 21:24
mveRichard MacCutchan27-Aug-12 21:24 
AnswerRe: C++ : pass a string array to LPARAM Pin
Maximilien27-Aug-12 9:22
Maximilien27-Aug-12 9:22 
AnswerRe: C++ : pass a string array to LPARAM Pin
CPallini27-Aug-12 9:43
mveCPallini27-Aug-12 9:43 
GeneralRe: C++ : pass a string array to LPARAM Pin
pasztorpisti27-Aug-12 10:32
pasztorpisti27-Aug-12 10:32 
GeneralRe: C++ : pass a string array to LPARAM Pin
CPallini27-Aug-12 21:10
mveCPallini27-Aug-12 21:10 
GeneralRe: C++ : pass a string array to LPARAM Pin
Atlence28-Aug-12 9:02
Atlence28-Aug-12 9:02 
QuestionRe: C++ : pass a string array to LPARAM Pin
CPallini28-Aug-12 9:59
mveCPallini28-Aug-12 9:59 
AnswerRe: C++ : pass a string array to LPARAM Pin
Atlence28-Aug-12 10:28
Atlence28-Aug-12 10:28 
QuestionRe: C++ : pass a string array to LPARAM Pin
CPallini28-Aug-12 22:58
mveCPallini28-Aug-12 22:58 
AnswerRe: C++ : pass a string array to LPARAM Pin
Atlence29-Aug-12 7:29
Atlence29-Aug-12 7:29 
AnswerRe: C++ : pass a string array to LPARAM Pin
Stefan_Lang27-Aug-12 23:08
Stefan_Lang27-Aug-12 23:08 
Questionhow to send a slider's value while scrolling.? Pin
mbatra3127-Aug-12 2:41
mbatra3127-Aug-12 2:41 
AnswerRe: how to send a slider's value while scrolling.? Pin
Chris Losinger27-Aug-12 3:18
professionalChris Losinger27-Aug-12 3:18 

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.