LRESULT IdleControlProc( HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam ) { RECT rc; HDC hDC; char* pFileName; PAINTSTRUCT ps; PWindowsTree pWin; pWin=(PWindowsTree)hWnd; switch(iMsg) { case LMSG_CREATE: pFileName=(char*)malloc(strlen((char*)lParam)+1); if(!pFileName) return false; strcpy(pFileName,(char*)lParam); pWin->dwAddData = (DWORD)pFileName; break; case LMSG_PENDOWN: break; case LMSG_PENUP: break; case LMSG_PENMOVE: break; case LMSG_PAINT: ps.bPaintDirect=false; hDC=BeginPaint(hWnd, &ps); if(!hDC) { return true; } scrGetClientRect(hWnd,&rc); ScreenToClientRect(hWnd,&rc); ShowBitmap(hDC,0,0,(char*)(pWin->dwAddData)); DrawText(hDC,"12:00",strlen("12:00"),&rc,DT_CENTER); EndPaint(hWnd, &ps); break; case LMSG_DESTROY: if((char*)(pWin->dwAddData)) free((char*)(pWin->dwAddData)); break; case LMSG_COMMAND: break; default: return DefWindowProc(hWnd, iMsg, wParam, lParam); } return true; }
void CBitmapDialog::OnPaint() { CPaintDC dc(this); // device context for painting ShowBitmap( &dc ); // Do not call CDialog::OnPaint() for painting messages }