I am using the clipboard for the first time and following
Swanke's book "Visual C++ MFC Programming by Example.",
This serializes my doc to the clipboard:
, CArchive::store | CArchive::bNoFlushOnDelete);
// flush and close the memory file
// pick out the memory file
HGLOBAL hMem = file.Detach();
// now stick this file into the clip board. the data source object
// will be deleted when the clipboard is emptied
COleDataSource* pDS = new COleDataSource();
When I get the the clip board part, I get an exception thrown with the message that I haven't called CoInitialize().
When I look in the doc, it says that I shouldn't use this in any new apps but should call CoInitializeEx(NULL). My problem is that I can't find this routine. No header file in MFC 6.0 seems to contain it and their is only one reference to CoInitialize(...) when I do a find on the MFC source code.
I have put the call to CoInitialize(NULL) in the InitInstance of the main app and that seems to work.
However, my questions are:
1. Should I be using CoInitializeEx(NULL)?
2. If so, which header file defines it?