fail to draw bitmap correctly with Bitblt()

Rer 80 Reputation points
2023-10-17T13:55:48.0933333+00:00

Part of callback function of a child window:


case WM_MOVE:
	hdc = GetDC(hChild);
	hdcMem = CreateCompatibleDC(hdc);
	SelectObject(hdcMem, hBitmap2);
	BitBlt(hdc, 0, 0, width / 4, height / 4, hdcMem, or_x, or_y, SRCCOPY);
	UpdateWindow(hChild);
	ReleaseDC(hChild, hdc);
	break;


It only paints when it has been initialized but not been redrawn when I move the child window. or_x and or_y is two varibles changing when callback function is called. (And it is tested to be changing indeed)

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,765 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,937 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.