import std.stdio;
import std.c.windows.windows;

extern (Windows) BOOL		OpenClipboard(HWND);
extern (Windows) BOOL		EmptyClipboard();
extern (Windows) HANDLE SetClipboardData (uint,HANDLE);
extern (Windows) BOOL 	CloseClipboard();

BOOL Clipboard_SetData(HWND hwnd, UINT fmt, HANDLE hMem)
{
BOOL b = OpenClipboard(hwnd);
writefln(b);
if(b)
{
printf("Yep\n");
EmptyClipboard();

b = cast(BOOL)SetClipboardData(fmt, hMem);

CloseClipboard();
}

return b;
}

extern (Windows)
int WinMain(HINSTANCE hInstance,	HINSTANCE hPrevInstance,	LPSTR lpCmdLine,	int nCmdShow)
{
	char[] string = "This is for the clipboard.";
	if(Clipboard_SetData(hInstance,1,cast(HANDLE)string)) {
		writefln("Success!");
	} else {
		writefln("Error!");
	}
	return 0;
}