Click here to change the theme.

The following is a small Windows program that shows a dialog.

Use a plain "Win32 Application" project for this. Do not use the AppWizard's option to generate source code; put the following code in a cpp file (such as DlgHello.cpp) and add that file to the project . The dialog resource is not provided here but it can quickly be created by the resource editor. Simply create a new dialog template for the project; it should work as created without any modification required.

#define STRICT
#include <windows.h>
#include "resource.h"

BOOL CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
	switch (message) {
			return (TRUE);
		case WM_COMMAND:
			switch (wParam) {
				case IDOK:
				case IDCANCEL:
					EndDialog(hDlg, TRUE);
					return (TRUE);
return (FALSE);

int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
	int ReturnValue;
ReturnValue = DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DialogProc, NULL);
return 0;

Hosted by WinHost.com.