#include "StdAfx.h" #include "T2SerialDialog.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif T2SerialDialog::T2SerialDialog(CWnd *parent) : CDialog(228, parent) { } /*virtual*/ void T2SerialDialog::DoDataExchange(CDataExchange *pDX) { CWnd::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(T2SerialDialog, CDialog) ON_WM_PAINT() END_MESSAGE_MAP() /*virtual*/ void T2SerialDialog::OnOK() { GetDlgItemText(1000, mStrings[0]); GetDlgItemText(1001, mStrings[1]); GetDlgItemText(1002, mStrings[2]); GetDlgItemText(1003, mStrings[3]); CDialog::OnOK(); } void T2SerialDialog::GetSerial(char *buf) { memcpy(&buf[0], mStrings[0], 4); memcpy(&buf[4], mStrings[1], 4); memcpy(&buf[8], mStrings[2], 4); memcpy(&buf[12], mStrings[3], 4); buf[16] = 0; } void T2SerialDialog::OnPaint() { #pragma var_order(bitmapDC, bitmap, bitmapDCSave, font1, save, font2, y, dc, bitmapData, rect) CPaintDC dc(this); int save = dc.SaveDC(); CRect rect; GetClientRect(rect); CFont font1; font1.CreatePointFont(100, "\x82\x6C\x82\x72\x20\x82\x6F\x83\x53\x83\x56\x83\x62\x83\x4E"); CFont font2; font2.CreatePointFont(80, "\x82\x6C\x82\x72\x20\x82\x6F\x83\x53\x83\x56\x83\x62\x83\x4E"); dc.SetBkMode(TRANSPARENT); int y = 15; dc.SelectObject(&font1); // "あなたのシリアル番号を入力してください。" - Please enter your serial number. dc.TextOut(10, y, "\x82\xA0\x82\xC8\x82\xBD\x82\xCC\x83\x56\x83\x8A\x83\x41\x83\x8B\x94\xD4\x8D\x86\x82\xF0\x93\xFC\x97\xCD\x82\xB5\x82\xC4\x82\xAD\x82\xBE\x82\xB3\x82\xA2\x81\x42"); // "A" y += dc.GetTextExtent("\x82\x60").cy + 10; dc.SelectObject(&font2); // "シリアル番号はユーザー登録のお願いに記載されています。" - The serial number is listed in the user registration request. dc.TextOut(10, y, "\x83\x56\x83\x8A\x83\x41\x83\x8B\x94\xD4\x8D\x86\x82\xCD\x83\x86\x81\x5B\x83\x55\x81\x5B\x93\x6F\x98\x5E\x82\xCC\x82\xA8\x8A\xE8\x82\xA2\x82\xC9\x8B\x4C\x8D\xDA\x82\xB3\x82\xEA\x82\xC4\x82\xA2\x82\xDC\x82\xB7\x81\x42"); CBitmap bitmap; bitmap.LoadBitmap(229); BITMAP bitmapData; bitmap.GetObject(sizeof(bitmapData), &bitmapData); CDC bitmapDC; bitmapDC.CreateCompatibleDC(&dc); int bitmapDCSave = bitmapDC.SaveDC(); bitmapDC.SelectObject(&bitmap); dc.SetTextColor(GetSysColor(COLOR_BTNSHADOW)); dc.SetBkColor(GetSysColor(COLOR_BTNFACE)); dc.BitBlt(0, rect.bottom - bitmapData.bmHeight, bitmapData.bmWidth, bitmapData.bmHeight, &bitmapDC, 0, 0, SRCCOPY); bitmapDC.RestoreDC(bitmapDCSave); dc.RestoreDC(save); bitmap.DeleteObject(); } /*virtual*/ BOOL T2SerialDialog::OnCommand(WPARAM wParam, LPARAM lParam) { int controlID = LOWORD(wParam); switch (LOWORD(controlID)) { case 1000: case 1001: case 1002: case 1003: if (HIWORD(wParam) == EN_CHANGE && GetDlgItem(controlID)->GetWindowTextLength() >= 4) { controlID++; if (controlID == 1004) controlID = 1000; GetDlgItem(controlID)->SetFocus(); } break; } return CWnd::OnCommand(wParam, lParam); }