switch(Msg) { case WM_INITDIALOG: { hInformation=GetDlgItem(hwnd,IDC_BUTTON1); hbmInformation=LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_BUTTON_COMMON)); hbmInformationHover=LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_BUTTON_PRESSED)); }break; case WM_DRAWITEM: { LPDRAWITEMSTRUCT lpdis=(LPDRAWITEMSTRUCT)lParam; HDC hdcMem=CreateCompatibleDC(lpdis->hDC); if (lpdis->hwndItem == hInformation) { HDC hCDC=CreateCompatibleDC(lpdis->hDC); HBITMAP &hBmp=bInformationStateButton?hbmInformationHover:hbmInformation; HBITMAP hBmpOld=(HBITMAP)SelectObject(hCDC,hBmp); StretchBlt(lpdis->hDC,0,0,lpdis->rcItem.right-lpdis->rcItem.left, lpdis->rcItem.bottom - lpdis->rcItem.top,hCDC,0,0, SizeBitmap(hBmp).cx, SizeBitmap(hBmp).cy,SRCCOPY); SelectObject(hCDC, hBmpOld); DeleteDC(hCDC); RsrcHand=FindResource(NULL,MAKEINTRESOURCE(IDR_RGN1),RsrcType); RsrcPoint=LoadResource(NULL,RsrcHand); RsrcSize=SizeofResource(NULL,RsrcHand); SetWindowRgn(hInformation,ExtCreateRegion(NULL,RsrcSize,(RGNDATA*) RsrcPoint),TRUE); } }break; case WM_COMMAND: { if (wParam==IDCANCEL) // Exit button { ExitProcess(0); } if (IDC_BUTTON1) { bInformationStateButton=TRUE; MessageBox(hwnd,"pressed","caption",MB_OK); // как быть дальше? } }break; case WM_CLOSE: { EndDialog(hwnd,0); }break; } return 0; } |