case WM_NCPAINT:
{
HDC hdc;
hdc = GetDCEx(hWnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN);
// Paint into this DC
TextOut(hdc,10,10,TEXT("abcd"),4);
ReleaseDC(hWnd, hdc);
WM_NCPAINT and GetDCEx()
Getting the device context when handling WM_NCPAINT does not work as described. [b]Additional undocumented flag 0x10000 has to be used:
case WM_NCPAINT:{ HDC hdc; hdc = GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW | DCX_INTERSECTRGN | 0x10000); // Paint into this DC ReleaseDC(hwnd, hdc);}
(Verified on Windows XP)
WIN7下貌似又有问题了。。。
case WM_NCPAINT:
ret=DefWindowProc(hwnd,message,wParam,lParam);
hdc=GetWindowDC(hwnd);
// Paint into this DC
if(hdc)
{
TextOut(hdc,400,10,TEXT("abcd"),4);
Release……
[/Quote]
case WM_NCPAINT:
ret=DefWindowProc(hwnd,message,wParam,lParam);
hdc=GetWindowDC(hwnd);
// Paint into this DC
if(hdc)
{
TextOut(hdc,400,10,TEXT("abcd"),4);
ReleaseDC(hwnd, hdc……
[/Quote]
case WM_NCPAINT:
ret=DefWindowProc(hwnd,message,wParam,lParam);
hdc=GetWindowDC(hwnd);
// Paint into this DC
if(hdc)
{
TextOut(hdc,400,10,TEXT("abcd"),4);
ReleaseDC(hwnd, hdc);
}
return ret;
//break;