-
why ?
#include <windows.h>
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASS WndClass;
WndClass.style = 0;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.lpfnWndProc = WndProc;
WndClass.hInstance = hInstance;
WndClass.hbrBackground = (HBRUSH) (COLOR_WINDOW +1);
WndClass.hCursor = 0;
WndClass.hIcon = 0;
WndClass.lpszMenuName = 0;
WndClass.lpszClassName = "WinProg";
RegisterClass(&WndClass);
HWND hWindow;
hWindow = CreateWindow("WinProg","Window",WS_OVERLAPPEDWINDO W,0,0,400,400,NULL,NULL,hInstance,NULL);
ShowWindow(hWindow, nCmdShow);
UpdateWindow(hWindow);
MSG Message;
while (GetMessage(&Message,NULL,0,0))
{
DispatchMessage(&Message);
}
return (Message.wParam);
}
LRESULT CALLBACK WndProc (HWND hWnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
{
switch(uiMessage)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc (hWnd, uiMessage,wParam, lParam);
}
}
The window shows up fine but a dos window also pops up in the back, how do you get rid of the dos window ?
-
&TH of undefined behavior
Its your compiler (or more accurately - the linker)......the difference between a console app and a win32 app is a simple linker parameter.....
On VC++ you would create a windows app instead of a console app....same goes for Codewarrior & Devc++
Popular pages
Recent additions