Ocu da prikazem slika u full screnu so frejmova u C++

Započeo Darko Ristevski, Septembar 08, 2018, 18:37:20 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Ocu da prikazem slika u cel ekrana so frejmova, imam koda no kako da napravim Bitmap sa frejmovima? kada zapustim aplikaciju pokazuje samo jeden frejm, Sta da uradim da radi?


void (payloadAnimation) {
WNDCLASSEX c;
c.cbSize = sizeof(WNDCLASSEX);
c.lpfnWndProc = WindowProcNoClose;
c.lpszClassName = L"aniwnd";
c.style = 0;
c.cbClsExtra = 0;
c.cbWndExtra = 0;
c.hInstance = NULL;
c.hIcon = 0;
c.hCursor = LoadCursor(NULL, IDC_ARROW);
c.hbrBackground = NULL;
c.lpszMenuName = NULL;
c.hIconSm = 0;

RegisterClassEx(&c);

w = GetSystemMetrics(SM_CXSCREEN);
h = GetSystemMetrics(SM_CYSCREEN);

animationWindow = CreateWindowExW(WS_EX_TOPMOST | WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW, L"aniwnd", L"",
WS_POPUP, 0, 0, w, h, NULL, NULL, GetModuleHandle(NULL), NULL);

ShowWindow(animationWindow, SW_SHOW);

CreateThread(NULL, 0, &animationThread, NULL, 0, NULL);

MSG msg;
while (GetMessage(&msg, NULL, 0, 0) > 0 && !bonzi) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}

return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        DWORD WINAPI animationThread(LPVOID parameter) {
HDC hdc = GetDC(animationWindow);

HBITMAP dickImg = (HBITMAP)LoadImageW(NULL, L"Data\\1.bin", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_LOADTRANSPARENT);
HDC hdc2 = CreateCompatibleDC(hdc);
SelectObject(hdc2, dickImg);

HBITMAP bitmap = CreateCompatibleBitmap(hdc, w, h);
HDC hdc4 = CreateCompatibleDC(hdc);
SelectObject(hdc4, bitmap);

POINT zero;
memSet(&zero, 0, sizeof(zero));

SIZE size;
size.cx = w;
size.cy = h;

for (frame = 0; frame < 60; frame++) {
StretchBlt(hdc4, 0, 0, w, h, hdc2, 0, frame * 157, 276, 157, SRCCOPY);
UpdateLayeredWindow(animationWindow, NULL, NULL, &size, hdc4, &zero, RGB(255, 255, 255), NULL, ULW_COLORKEY);
Sleep(50);
}

Sleep(5000);

for (; frame > 0; --frame) {
StretchBlt(hdc4, 0, 0, w, h, hdc2, 0, frame * 157, 276, 157, SRCCOPY);
UpdateLayeredWindow(animationWindow, NULL, NULL, &size, hdc4, &zero, RGB(255, 255, 255), NULL, ULW_COLORKEY);
Sleep(50);
}

DeleteDC(hdc2);

BitBlt(hdc4, 0, 0, w, h, hdc4, 0, 0, WHITENESS);
UpdateLayeredWindow(animationWindow, NULL, NULL, &size, hdc4, &zero, RGB(255, 255, 255), NULL, ULW_COLORKEY);
Poslednja Izmena: Septembar 08, 2018, 18:42:45 POSLE PODNE od Darko Ristevski