|
switch (wMsg)
{
case WM_CREATE: hInstance = ((LPCREATESTRUCT) lParam)->hInstance ;
hBitmap = LoadBitmap (hInstance, MAKEINTRESOURCE(bitmap_point)) ;
GetObject (hBitmap, sizeof (BITMAP), &bitmap) ;
cxSource = bitmap.bmWidth ;
cySource = bitmap.bmHeight ;
return 0 ;
case WM_PAINT: hdc = BeginPaint (hWnd, &ps) ;
hdcMem = CreateCompatibleDC (hdc) ;
SelectObject (hdcMem, hBitmap) ;
for (y = 0 ; y < cyClient ; y += cySource)
for (x = 0 ; x < cxClient ; x += cxSource)
{
BitBlt (hdc, x, y, cxSource, cySource, hdcMem, 0, 0, SRCCOPY) ;
}
DeleteDC (hdcMem) ;
EndPaint (hWnd, &ps) ;
return 0 ;
case WM_SIZE: cxClient = LOWORD (lParam) ;
cyClient = HIWORD (lParam) ;
return 0 ;
case WM_HIBERNATE: DoHibernateMain (hWnd, wMsg, wParam, lParam); //
return 0 ;
case WM_ACTIVATE: DoActivateMain (hWnd, wMsg, wParam, lParam); //发此消息给应用程序哪个窗口是激活的,哪个是非激活的;
return 0 ;
case WM_DESTROY: DeleteObject (hBitmap) ;
// PostQuitMessage (0); //一个窗口被销毁
return 0 ;
case WM_LBUTTONDOWN: bitmap_point = IDB_BITMAP1;
//hInstance = ((LPCREATESTRUCT) lParam)->hInstance ;
hBitmap = LoadBitmap (hInstance, MAKEINTRESOURCE(bitmap_point)) ;
GetObject (hBitmap, sizeof (BITMAP), &bitmap) ;
cxSource = bitmap.bmWidth ;
cySource = bitmap.bmHeight ;
DoActivateMain (hWnd, wMsg, wParam, lParam);
InvalidateRect (hWnd, NULL, TRUE) ;
return 0 ;
}
return DefWindowProc (hWnd, wMsg, wParam, lParam);
可是不知道为什么?在case WM_CREATE: 中,hBitmap = LoadBitmap (hInstance, MAKEINTRESOURCE(bitmap_point)) ;
有返回值,可在case WM_LBUTTONDOWN:中,hBitmap = LoadBitmap (hInstance, MAKEINTRESOURCE(bitmap_point)) ;的返回值总是为0,请高手指点啊!!
|
|