Hi,

I am just a beginner at windows programming, so I am wondering, how do I create a dialog-based application (similar to that of using VC++ and MFC) with just the pure windows API?

Currently I am just doing the following, but I have a slight feeling in my gut it's not the correct way to do it ;)

HWND g_dlg = NULL;

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
	g_dlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_CALC), NULL, CalcProc);
	ShowWindow(g_dlg, SW_SHOW);

	MSG msg;
	while (GetMessage(&msg, NULL, 0, 0) > 0)
	{
		if (!IsDialogMessage(g_dlg, &msg))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}
	return 0;
}

Any help is greatly appreciated :) Thank you very much.

You have to do everything that MFC does for you manually. That's a pretty broad topic because "dialog-based application" covers a LOT of stuff. You should consider picking up Charles Petzold's Programming Windows.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.