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
| #include <windows.h>
const int nScreenWidth=GetSystemMetrics(SM_CXSCREEN), nScreenHeight=GetSystemMetrics(SM_CYSCREEN);
LRESULT WINAPI MelterProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch(Msg){
case WM_CREATE:
{
ShowWindow(hWnd, SW_SHOW);
HBITMAP hImage = (HBITMAP)LoadImage(NULL, (LPCSTR)"fond.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
HWND hImageView = CreateWindowEx(NULL, (LPCSTR)"STATIC", NULL, SS_BITMAP | WS_VISIBLE | WS_CHILD, 0, 0, 0, 0, hWnd, NULL, GetModuleHandle(NULL), NULL);
SendMessage(hImageView, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hImage);
return 0;
}
case WM_PAINT:
{
??
return 0;
}
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrev, LPSTR lpCmdLine, int nShowCmd)
{
WNDCLASS wndClass = { 0, MelterProc, 0, 0, hInstance, NULL, LoadCursor(NULL, IDC_ARROW), GetSysColorBrush(COLOR_3DFACE), NULL, "nom" };
if(!RegisterClass(&wndClass)) return MessageBox(HWND_DESKTOP, "Cannot register class!", NULL, MB_ICONERROR | MB_OK);
HWND hWnd = CreateWindow("nom", NULL, WS_POPUP , 0, 0, nScreenWidth, nScreenHeight, HWND_DESKTOP, NULL, hInstance, NULL);
if(!hWnd) return MessageBox(HWND_DESKTOP, "Cannot create window!", NULL, MB_ICONERROR | MB_OK);
MSG messages = { 0 };
while (GetMessage (&messages, NULL, 0, 0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return 0;
} |
Partager