INT_PTR CALLBACK CBPositionDlgBox(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: CreateMinimap(); SetWindowText(GetDlgItem(hwndDlg, IDC_APHEAD), mpheadstr); break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: {char buf[16]; buf[15] = 0; GetWindowText(GetDlgItem(hwndDlg, IDC_EDITXPOS), buf, 15); resx = atoi(buf); GetWindowText(GetDlgItem(hwndDlg, IDC_EDITZPOS), buf, 15); resz = atoi(buf); EndDialog(hwndDlg, 1); return TRUE;} case IDCANCEL: EndDialog(hwndDlg, 0); return TRUE; } break; case WM_LBUTTONDOWN: {int x = (LOWORD(lParam) - bmpx)*5, y = -(HIWORD(lParam) - (mmh-1) - bmpy)*5; if(((uint)x >= mmw*5) || ((uint)y >= mmh*5)) break; HWND hx = GetDlgItem(hwndDlg, IDC_EDITXPOS), hz = GetDlgItem(hwndDlg, IDC_EDITZPOS); char buf[16]; _itoa(x, buf, 10); SetWindowText(hx, buf); _itoa(y, buf, 10); SetWindowText(hz, buf); break;} case WM_PAINT: {PAINTSTRUCT ps; HDC hdc = BeginPaint(hwndDlg, &ps); //DrawIcon(hdc, 0, 0, LoadIcon(NULL, IDI_INFORMATION)); StretchDIBits(hdc, bmpx, bmpy, mmw, mmh, 0, 0, mmw, mmh, minimap, &mbih, DIB_RGB_COLORS, SRCCOPY); EndPaint(hwndDlg, &ps); break;} case WM_CLOSE: EndDialog(hwndDlg, 0); return TRUE; default: return FALSE; } return TRUE; }
void CTisDialog::OnMinimap() { CreateMinimap(GetSafeHwnd()); }