bonjour, voici un code ke g tapé pour mon apprentissage de la prog Graphique :
#include <windows.h>
LRESULT CALLBACK WinProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return WinProc(hWnd, uMsg, wParam, lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE thisInstance, HINSTANCE PrevInstance, LPSTR CommandLine, int CmdShow)
{
WNDCLASSEX w;
MSG msg;
HWND hwnd;
char clsName[] = "Wini";
char caption[] = "Caption de la fen";
w.cbSize = sizeof(WNDCLASSEX);
w.cbClsExtra = 0;
w.cbWndExtra = 0;
w.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
w.hCursor = LoadCursor(thisInstance, IDC_ARROW);
w.hIcon = LoadIcon(thisInstance, IDI_APPLICATION);
w.hIconSm = LoadIcon(thisInstance, IDI_APPLICATION);
w.hInstance = thisInstance;
w.lpfnWndProc = WinProc;
w.lpszClassName = clsName;
w.lpszMenuName = 0;
w.style = CS_VREDRAW | CS_HREDRAW;
if(RegisterClassEx(&w)) { MessageBox(0,"REGISTERCLASSEX ERROR","ERROR", MB_OK);return 0; }
hwnd = CreateWindowEx( 0, clsName, caption, WS_OVERLAPPEDWINDOW, 100,100,100,100, HWND_DESKTOP,0, thisInstance, 0);
if(!hwnd) { MessageBox(0,"HWND ERROR","ERROR", MB_OK);return 0; }
ShowWindow(hwnd, CmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg,0,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
Mai il ne marche pas !!!
Ou est l'erreur ?