dev Dev'IFileOperation' undeclare (C++)

dev Dev'IFileOperation' undeclared (C++)

本文关键字:C++ undeclare dev IFileOperation Dev      更新时间:2023-10-16

我想添加对象 IFileOperationIShellItem,但是我无法以任何方式填充源并给我回馈:

IFileOperation - undeclared (first use in this function)

我正在使用dev-c 与链接器的参数: -luuid -lole32

我想我必须添加其他标题,但是每个Google搜索都不成功。你有什么主意吗?

#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();
}

我怀疑您需要将程序链接到Shell32.lib
尝试转到程序设置,然后找到链接器并将-lShell32.lib添加到它并保存。

无论如何,当您开始编程并且想编写一些代码,对其进行编译并运行它时,Dev-C 是一个不错的编译器。但是,这种IDE非常古老和不高效,如果您使用Windows,请考虑搬到Visual Studio。