Skip to content

Instantly share code, notes, and snippets.

@kumatti1
Created January 1, 2016 23:44
Show Gist options
  • Save kumatti1/98016fc99d86b2a4c6bb to your computer and use it in GitHub Desktop.
Save kumatti1/98016fc99d86b2a4c6bb to your computer and use it in GitHub Desktop.
リンク出来た(`・ω・´)ゞ
#include <windows.h>
#include <Shlobj.h>
#pragma comment(lib,"ole32.lib")
#pragma comment(lib,"user32.lib")
#pragma comment(lib,"shell32.lib")
#pragma comment(lib,"shdocvw.Lib")
extern "C" HRESULT __stdcall SHGetIDispatchForFolder(
ITEMIDLIST *pidl,
void** ppv
);
void Main()
{
ITEMIDLIST *pidl;
HRESULT hr = SHGetSpecialFolderLocation(0, CSIDL_PERSONAL, &pidl);
IDispatch *pDisp;
hr = SHGetIDispatchForFolder(pidl, (void**) &pDisp);
if (pDisp){
pDisp->Release();
}
ILFree(pidl);
}
int CALLBACK WinMain(
_In_ HINSTANCE hInstance,
_In_ HINSTANCE hPrevInstance,
_In_ LPSTR lpCmdLine,
_In_ int nCmdShow
)
{
CoInitialize(nullptr);
Main();
CoUninitialize();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment