All pastes #408253 Raw Edit

ggf

public text v1 · immutable
#408253 ·published 2007-03-24 18:25 UTC
rendered paste body
#include <stdio.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>

void MessageLoop(PMSG, HWND);

int main(){

   MSG msg;
   HWND hwnd;
   WNDCLASS wndclass;
   HINSTANCE hInst = GetCurrentProcess();

   wndclass.style = 0;
   wndclass.lpfnWndProc = DefWindowProc;
   wndclass.cbClsExtra = 0;
   wndclass.cbWndExtra = 0;
   wndclass.hInstance = hInst;
   wndclass.hIcon = NULL;
   wndclass.hCursor = 0;
   wndclass.hbrBackground = GetSysColorBrush(6);
   wndclass.lpszMenuName = NULL;
   wndclass.lpszClassName = "Sample window";

   RegisterClass(&wndclass);

   hwnd = CreateWindow(
	"Sample window",
	"Sample",
	WS_SYSMENU|WS_MINIMIZEBOX|WS_DLGFRAME|WS_VISIBLE,
	80,
	80,
	765,
	503,
	NULL,
	NULL,
	hInst,
	NULL
   );

   MessageLoop(&msg, hwnd);
   UnregisterClass("Sample window", hInst);

}

void MessageLoop(PMSG msg, HWND hwnd){
   while(GetMessage(msg,hwnd,0,0) > 0){
	TranslateMessage(msg);
	DispatchMessage(msg);
   }
}