Очень мало нужно обрабатывать окна Win32.
Вы можете попробовать это, например:
ATOM MyRegisterClass( HINSTANCE hInstance, TCHAR* szWindowClass );
HWND InitInstance(HINSTANCE hInstance, int nCmdShow, TCHAR* szWindowClass, TCHAR* szTitle, int width, int height );
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
HACCEL hAccelTable;
// Initialize global strings
MyRegisterClass( hInstance, _T( "MyWinClass" ) );
// Perform application initialization:
HWND hWnd = InitInstance (hInstance, SW_SHOWDEFAULT, _T( "MyWinClass" ), _T( "D3D Renderer" ), 1024, 768 );
if ( hWnd == NULL )
{
return FALSE;
}
// INIT D3D!
// INIT D3D!
// INIT D3D!
MSG msg;
msg.message = 0;
// Main message loop:
while( msg.message != WM_QUIT )
{
// DO D3D RENDERING!
// DO D3D RENDERING!
// DO D3D RENDERING!
if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
{
Sleep( 0 );
}
}
// SHUTDOWN D3D!
// SHUTDOWN D3D!
// SHUTDOWN D3D!
return 0;
}
ATOM MyRegisterClass( HINSTANCE hInstance, TCHAR* szWindowClass )
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_CLASSDC;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = NULL;
wcex.hCursor = NULL;
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = NULL;
return RegisterClassEx(&wcex);
}
HWND InitInstance(HINSTANCE hInstance, int nCmdShow, TCHAR* szWindowClass, TCHAR* szTitle, int width, int height )
{
hInst = hInstance; // Store instance handle in our global variable
HWND hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, width, height, NULL, NULL, hInstance, NULL);
if ( hWnd == NULL )
{
return hWnd;
}
ShowWindow(ghWnd, nCmdShow);
UpdateWindow(ghWnd);
return hWnd;
}
И это буквально весь код, связанный с окнами.тебе нужно.