关于CoInitializeEx()函数一问?
我在编写com客户程序时,像调用CoInitializeEx(),但却得到编译错误,代码如下:
#include "stdafx.h"
#include "ActiveDesktop.h"
#include <comutil.h>
#include <windows.h>
#include <objbase.h>
#define _WIN32_DCOM
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
if(FAILED(CoInitializeEx(NULL,(COINIT_MULTITHREADED))
{
cerr << _T("Fatal Error: OLE initialization failed") << endl;
return 1;
}
编译说找不到CoInitializeEx()函数,可我引用了那么多头文件了,请大虾指教!