1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#include <d3dx9.h>
#include <d3d9.h>
#include <windows.h>
#include <ddraw.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow);
LRESULT CALLBACK WindowProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow)
{
WNDCLASS wc;
HWND hWnd;
MSG msg;
LPSTR lpName="toto";
memset(&wc, 0, sizeof(WNDCLASS));
wc.style=CS_HREDRAW|CS_VREDRAW;
wc.hInstance=hInstance;
wc.hbrBackground =(HBRUSH) COLOR_WINDOW;
wc.lpszClassName=lpName;
wc.lpfnWndProc=WindowProc;
RegisterClass(&wc);
hWnd=CreateWindow(lpName,lpName,WS_OVERLAPPEDWINDOW,0,0,300,300,NULL,NULL,hInstance,NULL);
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
while( GetMessage( &msg, NULL, 0, 0) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
return 0;
}
LRESULT CALLBACK WindowProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{
switch(message)
{
case WM_DESTROY :
PostQuitMessage(0);
break;
}
return DefWindowProc( hwnd, message, wParam, lParam );
} |
Partager