I am completely new to C++/WinRT. I read some articles on winrt::capture and tried the following code:
#include "pch.h"
#include <Shobjidl.h>
// EDIT: use winrt::guid_of<IDesktopWallpaper>.
// Previously I used CLSID_DesktopWallpaper which did not work.
auto d = winrt::create_instance<IDesktopWallpaper>(winrt::guid_of<IDesktopWallpaper>(), CLSCTX_ALL);
Now there is another weird compile error on undefined identifier:
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\shobjidl_core.h(33547,11): error C2061: syntax error: identifier 'CMINVOKECOMMANDINFO'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\shobjidl_core.h(33552,61): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
// Shobjidl_core.h:
/* [local] */ HRESULT STDMETHODCALLTYPE IContextMenu_InvokeCommand_Proxy(
IContextMenu * This,
/* [annotation][in] */
_In_ CMINVOKECOMMANDINFO *pici);
But Shobjidl_core.h does have the following declaration:
typedef struct _CMINVOKECOMMANDINFO
{
DWORD cbSize;
DWORD fMask;
HWND hwnd;
LPCSTR lpVerb;
LPCSTR lpParameters;
LPCSTR lpDirectory;
int nShow;
DWORD dwHotKey;
HANDLE hIcon;
} CMINVOKECOMMANDINFO;
OT: When I edit my post, "Edit development language" on code blocks never works for me from the beginning. For example, if I select "C++/WinRT", it will strangely change language to XML!
E.O.F