以下是wndproc的源码,window style包含了WM_OWNDCLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
char exam[100];
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
static RECT fr;
static POINT p;
switch (message)
{
case WM_SIZE:
p.x=LOWORD(lParam);
p.y=HIWORD(lParam);
hdc = BeginPaint(hWnd, &ps);
SetMapMode(hdc,MM_ISOTROPIC);
SetWindowExtEx(hdc,lcxmax,lcymax,0);
SetViewportExtEx(hdc,p.x,p.y,0);
fr.top=0;
fr.left=0;
DPtoLP(hdc,&p,1);
fr.bottom=p.y;
fr.right=p.x;
EndPaint(hWnd, &ps);
break;
case WM_COMMAND:
wmId    = LOWORD(wParam);
wmEvent = HIWORD(wParam);
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
hdc=GetDC(hWnd);
//Rectangle(hdc,fr.left,fr.top,fr.right,fr.bottom);
FrameRect(hdc,&fr,CreateSolidBrush(RGB(128,256,128)));
ReleaseDC(hWnd,hdc);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
有时有边框有时又没有,有时会出现杂纹,而且边框也不总是贴紧窗口边框的