All pastes #543093 Raw Edit

directory.dll

public cpp v1 · immutable
·published 2007-06-06 00:27 UTC
rendered paste body
#define EXPORT __declspec(dllexport)#include <windows.h>#include <shlobj.h>#include <objbase.h>extern "C"int EXPORT __stdcall ChooseDirectory(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause){	char *path = (char *)malloc(MAX_PATH);	char *junk = (char *)malloc(MAX_PATH);	CoInitialize(NULL);	BROWSEINFO bi;	bi.hwndOwner = mWnd;	bi.pidlRoot = NULL;	bi.lpszTitle = "Choose Directory...";	bi.ulFlags = BIF_NEWDIALOGSTYLE;	bi.lpfn = NULL;	bi.pszDisplayName = junk;	LPITEMIDLIST pidl = SHBrowseForFolder(&bi);	if (pidl)	{		SHGetPathFromIDList(pidl, path);	}	strcpy(data, path);	return 3;}