错误C2065:'CoInitializeEx':未声明的标识符

1 c++ mfc

尝试使用时出现以下错误 hres = CoInitializeEx(0, COINIT_MULTITHREADED);

错误C2065:'CoInitializeEx':未声明的标识符

我已经包括:

#define _WIN32_DCOM
#include <iostream>
using namespace std;
#include <comdef.h>
#include <Wbemidl.h>
Run Code Online (Sandbox Code Playgroud)

在我的cpp文件中.

请帮助.

谢谢,Neha

aru*_*rul 5

尝试将以下行放在预编译头(stdafx.h)的开头.

#define _WIN32_WINNT 0x0400
Run Code Online (Sandbox Code Playgroud)