Click here to Skip to main content
15,895,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Compiler Setting VC++ 2008 Pin
Jaroslav Kaas20-Jul-10 2:16
Jaroslav Kaas20-Jul-10 2:16 
GeneralRe: Compiler Setting VC++ 2008 Pin
T.RATHA KRISHNAN20-Jul-10 2:49
T.RATHA KRISHNAN20-Jul-10 2:49 
AnswerRe: Compiler Setting VC++ 2008 Pin
Code-o-mat20-Jul-10 2:58
Code-o-mat20-Jul-10 2:58 
AnswerRe: Compiler Setting VC++ 2008 Pin
Aescleal20-Jul-10 3:03
Aescleal20-Jul-10 3:03 
GeneralRe: Compiler Setting VC++ 2008 Pin
T.RATHA KRISHNAN20-Jul-10 3:18
T.RATHA KRISHNAN20-Jul-10 3:18 
GeneralRe: Compiler Setting VC++ 2008 Pin
Aescleal20-Jul-10 3:25
Aescleal20-Jul-10 3:25 
GeneralRe: Compiler Setting VC++ 2008 Pin
T.RATHA KRISHNAN21-Jul-10 2:11
T.RATHA KRISHNAN21-Jul-10 2:11 
QuestionCoInitialize has not been called Pin
MsmVc19-Jul-10 20:41
MsmVc19-Jul-10 20:41 
Hi All

I am getting error CoInitialize has not been called.Code is here
void Ctest::OnCopyData()
{
::CoInitialize(NULL);
	COleDataSource* pSource = CopyTextList();
    if (!pSource)
        return;

	pSource->SetClipboard();

}

COleDataSource* Ctest::CopyTextFromList()
{
    USES_CONVERSION;

	CSharedFile sf(GMEM_MOVEABLE | GMEM_DDESHARE | GMEM_ZEROINIT);
	 CString str;
	int nPos=m_test.GetItemCount();
	for(int i=0;i<nPos;i++)
	{
		CString GetData=m_test.GetItemText(i,0);
		str+=GetData;
		str += _T("\r\n");
        sf.Write(T2A(str.GetBuffer(1)), str.GetLength());
        str.ReleaseBuffer();
	}
	
	 char c = '\0';
	 sf.Write(&c, 1);

	  DWORD dwLen = (DWORD) sf.GetLength();
    HGLOBAL hMem = sf.Detach();
    if (!hMem)
        return NULL;

    hMem = ::GlobalReAlloc(hMem, dwLen, GMEM_MOVEABLE | GMEM_DDESHARE | GMEM_ZEROINIT);
    if (!hMem)
        return NULL;

    // Cache data
    COleDataSource* pSource = new COleDataSource();
    pSource->CacheGlobalData(CF_TEXT, hMem);

    return pSource;
}

Please help me
AnswerRe: CoInitialize has not been called Pin
KarstenK19-Jul-10 21:45
mveKarstenK19-Jul-10 21:45 
AnswerRe: CoInitialize has not been called Pin
Aescleal19-Jul-10 21:45
Aescleal19-Jul-10 21:45 
AnswerRe: CoInitialize has not been called Pin
Niklas L19-Jul-10 21:45
Niklas L19-Jul-10 21:45 
AnswerRe: CoInitialize has not been called Pin
Sauro Viti19-Jul-10 23:22
professionalSauro Viti19-Jul-10 23:22 
QuestionProcess terminates spontaneously - No exception dialogue Pin
shoppinit19-Jul-10 11:04
shoppinit19-Jul-10 11:04 
AnswerRe: Process terminates spontaneously - No exception dialogue Pin
Luc Pattyn19-Jul-10 12:23
sitebuilderLuc Pattyn19-Jul-10 12:23 
GeneralRe: Process terminates spontaneously - No exception dialogue Pin
shoppinit23-Jul-10 2:12
shoppinit23-Jul-10 2:12 
GeneralRe: Process terminates spontaneously - No exception dialogue Pin
Luc Pattyn23-Jul-10 2:25
sitebuilderLuc Pattyn23-Jul-10 2:25 
GeneralRe: Process terminates spontaneously - No exception dialogue Pin
shoppinit27-Jul-10 8:14
shoppinit27-Jul-10 8:14 
GeneralRe: Process terminates spontaneously - No exception dialogue Pin
shoppinit6-Aug-10 17:41
shoppinit6-Aug-10 17:41 
AnswerRe: Process terminates spontaneously - No exception dialogue Pin
KarstenK19-Jul-10 21:47
mveKarstenK19-Jul-10 21:47 
Questionerror PRJ0019 Pin
mcdoloand19-Jul-10 8:49
mcdoloand19-Jul-10 8:49 
AnswerRe: error PRJ0019 Pin
Chris Losinger19-Jul-10 9:16
professionalChris Losinger19-Jul-10 9:16 
GeneralRe: error PRJ0019 Pin
mcdoloand20-Jul-10 7:37
mcdoloand20-Jul-10 7:37 
AnswerRe: error PRJ0019 Pin
David Crow20-Jul-10 9:40
David Crow20-Jul-10 9:40 
Questioncompletely restrict mouse movement (including raw data) Pin
3Dizard19-Jul-10 2:23
3Dizard19-Jul-10 2:23 
AnswerRe: completely restrict mouse movement (including raw data) Pin
elchupathingy19-Jul-10 3:37
elchupathingy19-Jul-10 3:37 

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.