jagstang Pa Capona ಠ_ಠ | j'avais fait ça à l'époque si ça peut t'aider.
Code :
- //---------------------------------------------------------------------------
- #include <windows.h>
- #pragma hdrstop
- //---------------------------------------------------------------------------
- #define CLASS_NAME "zMaPremiereWinAppNative"
- #define WINDOW_NAME "Ma Premiere Application Windows Native"
- #define TOP 0
- #define LEFT 0
- #define WIDTH 640
- #define HEIGHT 480
- HINSTANCE hInst ;
- HWND hwndMain ;
- LRESULT CALLBACK WndProcMain(HWND hwnd, // handle of window
- UINT uMsg, // message identifier
- WPARAM wParam, // first message parameter
- LPARAM lParam)
- {
- switch (uMsg)
- {
- case WM_COMMAND:
- break ;
- case WM_CREATE:
- break ;
- case WM_DESTROY :
- PostQuitMessage(0);
- break;
- default :
- return( DefWindowProc( hwnd, uMsg, wParam, lParam ) );
- }
- return 0L ;
- }
- #pragma argsused
- WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
- {
- LPVOID errMsg ;
- WNDCLASS wc ;
- MSG msg;
- if (!hPrevInstance)
- {
- wc.style = 0 ;
- wc.lpfnWndProc = ( WNDPROC ) WndProcMain ;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hIcon = LoadIcon((HINSTANCE) NULL,
- IDI_APPLICATION);
- wc.hCursor = LoadCursor((HINSTANCE) NULL,
- IDC_ARROW);
- wc.hbrBackground = GetStockObject(WHITE_BRUSH);
- wc.lpszClassName = CLASS_NAME ;
- if (!RegisterClass(&wc))
- return FALSE;
- }
- hInst = hInstance ;
- hwndMain = CreateWindow(CLASS_NAME,
- WINDOW_NAME,
- WS_OVERLAPPEDWINDOW,
- TOP, // CW_USEDEFAULT
- LEFT, // 0
- WIDTH, // CW_USEDEFAULT
- HEIGHT, // 0
- NULL,
- NULL,
- hInst,
- NULL) ;
- if (!hwndMain)
- {
- FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR) &errMsg,
- 0,
- NULL);
- MessageBox( NULL, errMsg, "GetLastError", MB_OK|MB_ICONINFORMATION );
- LocalFree( errMsg );
- }
- ShowWindow(hwndMain, nCmdShow) ;
- UpdateWindow(hwndMain) ;
- while (GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return msg.wParam ;
- }
|
|