Cau
Nejde mi vykreslit obrazek, pomoci DrawState
#include <windows.h>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
void OnPaint(HDC hDC);
HINSTANCE hInstance;
HBITMAP hBitmap;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
TCHAR szName[] = TEXT ("Project");
HWND hWnd;
MSG msg;
WNDCLASSEX wc;
HDC hDC;
wc.cbSize = sizeof(wc);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance,
IDI_APPLICATION);
wc.hIconSm = NULL;
wc.hCursor = LoadCursor(NULL,
IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW +1);
wc.lpszMenuName = NULL;
wc.lpszClassName = szName;
RegisterClassEx(&wc);
hWnd = CreateWindow(szName, szName, WS_CAPTION,CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
ShowWindow(hWnd, iCmdShow);
UpdateWindow(hWnd);
OnPaint(hDC);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
void OnPaint(HDC hDC)
{
hBitmap = (HBITMAP) LoadImage(hInstance, "obrazek.bmp",
IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE);
DrawState(hDC, NULL, NULL, (LPARAM)hBitmap, 0, 20, 20,
50, 50, DST_BITMAP);
return;
}
LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HMENU hMenu;
HINSTANCE hInstance;
HDC hDC;
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
Prosim, nekdo mi rychle pomozte
Dekuju za vse