I'm just learning how to program with the windows API, so maybe I'm missing something, but it seems odd to me.

I've been reading "Programming Windows" and started to make something using the mapping modes so I could get a better idea of how they worked. I noticed that if I held the cursor over any of the buttons at the top of the window (close, minimize, etc...) that the description of that button doesn't completely go away.

After playing with it for a while I noticed that if I had CS_OWNDC set in my window class it would do this if the function SetViewportOrgEx() was present. If one of those two things weren't there it would work.

Does anyone know why this happens? I'd really appreciate any help.

Here's some code. I took a bunch of stuff out of it so it would be shorter.


Code:
#include <windows.h>


LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam,
						 LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
				   PSTR CmdLine, int iCmdShow)
{
	TCHAR szProg[] = TEXT ("Program...");
	HWND hwnd;
	MSG msg;
	WNDCLASS wndclass;

	wndclass.cbClsExtra	= 0;
	wndclass.cbWndExtra	= 0;
	wndclass.hbrBackground	= (HBRUSH) GetStockObject(WHITE_BRUSH);
	wndclass.hCursor	= LoadCursor(NULL, IDC_ARROW);
	wndclass.hIcon		= LoadIcon(NULL, IDI_APPLICATION);
	wndclass.hInstance	= hInstance;
	wndclass.lpfnWndProc	= WndProc;
	wndclass.lpszClassName	= szProg;
	wndclass.lpszMenuName	= NULL;
	wndclass.style		= CS_OWNDC | CS_HREDRAW | CS_VREDRAW;

	if ( !RegisterClass(&wndclass) )
	{
		MessageBox(NULL, TEXT("Error registering window class"),
			       szProg, MB_ICONERROR);
		return 0;
	}

	hwnd = CreateWindow(szProg, TEXT("..."),
		                WS_OVERLAPPEDWINDOW,
						CW_USEDEFAULT, CW_USEDEFAULT,
						200, 200,
						NULL, NULL, hInstance, NULL);

	ShowWindow(hwnd, iCmdShow);
	UpdateWindow(hwnd);

	while ( GetMessage(&msg, NULL, 0, 0) )
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return msg.wParam;
}


LRESULT CALLBACK WndProc(HWND hwnd, UINT message, 
						 WPARAM wParam, LPARAM lParam)
{
	static int cxClient, cyClient;
	HDC hdc;
	PAINTSTRUCT ps;

	switch ( message )
	{		
		case WM_SIZE:
			cxClient = LOWORD (lParam);
			cyClient = HIWORD (lParam);

			return 0;

		case WM_PAINT:
			hdc = BeginPaint(hwnd, &ps);
			
			SetMapMode(hdc, MM_ANISOTROPIC);
			SetViewportOrgEx(hdc, cxClient / 2, cyClient / 2, NULL);
			SetWindowExtEx(hdc, 1, 1, NULL);
			SetViewportExtEx(hdc, 5, -5, NULL);

			EndPaint(hwnd, &ps);

			return 0;

		case WM_DESTROY:
			PostQuitMessage(0);

			return 0;
	}

	return DefWindowProc(hwnd, message, wParam, lParam);
}