我想添加对象IFileOperation和IShellItem,但我不能以任何方式填充源代码并返回给我:
IFileOperation - undeclared (first use in this function)我使用Dev-C++和链接器的参数:-luuid -lole32
我想我必须添加其他标题,但并不是每个谷歌搜索都是成功的。你有什么想法吗?
#include <windows.h>
#include <shlobj.h>
int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
{
HRESULT hr;
IShellLink* pISL;
hr = CoCreateInstance(CLSID_ShellLink, // CLSID of coclass
NULL, // not used - aggregation
CLSCTX_INPROC_SERVER, // type of server
IID_IShellLink, // IID of interface
(void**) &pISL); // Pointer to our interface pointer
if(SUCCEEDED(hr))
{
pISL->Release();
}
else
{
// Couldn't create the COM object. hr holds the error code.
}
CoUninitialize();
}发布于 2015-05-05 21:32:26
我怀疑您需要将您的程序链接到Shell32.lib
尝试转到您的程序设置,然后找到链接器,并添加-lShell32.lib到它并保存。
无论如何,当你开始编程,你想写一些代码,编译并运行它时,Dev-C++是一个很好的编译器。但是这个IDE非常古老,效率也很低,如果你使用的是windows,可以考虑迁移到Visual studio。
https://stackoverflow.com/questions/30054146
复制相似问题