static int TimeEditorWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_CREATE: { HWND hwnd; HDC hdc; HWND timeedit, spin; SIZE size; hwnd = CreateWindow (CTRL_STATIC, PROMPT, WS_CHILD | WS_VISIBLE | SS_LEFT, IDC_STATIC, 10, 10, 210, 200, hWnd, 0); timefont = CreateLogFont (NULL, "System", "ISO8859-1", FONT_WEIGHT_BOOK, FONT_SLANT_ROMAN, FONT_FLIP_NIL, FONT_OTHER_AUTOSCALE, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_NONE, 32, 0); hdc = GetClientDC (hWnd); SelectFont (hdc, timefont); GetTextExtent (hdc, "00:00:00", -1, &size); ReleaseDC (hdc); timeedit = CreateWindow (CTRL_SLEDIT, "00:00:00", WS_CHILD | WS_VISIBLE | ES_BASELINE, IDC_EDIT, 40, 220, size.cx + 4, size.cy + 4, hWnd, 0); SetWindowFont (timeedit, timefont); old_edit_proc = SetWindowCallbackProc (timeedit, TimeEditBox); spin = CreateWindow (CTRL_SPINBOX, "", WS_CHILD | WS_VISIBLE, IDC_SPINBOX, 40 + size.cx + 6, 220 + (size.cy - 14) / 2, 20, 20, hWnd, 0); SendMessage (spin, SPM_SETTARGET, 0, timeedit); break; } case MSG_DESTROY: DestroyAllControls (hWnd); DestroyLogFont (timefont); return 0; case MSG_CLOSE: DestroyMainWindow (hWnd); PostQuitMessage (hWnd); return 0; } return DefaultMainWinProc (hWnd, message, wParam, lParam); }
static int PaletteWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { HDC hdc; int x, y; static GAL_Color colorPal[256], myPal[256]; switch (message) { case MSG_CREATE: GetPalette(HDC_SCREEN, 0, 256, colorPal); #ifdef _DEBUG int i; for (i = 0; i < 256; i++) { printf ("i = %d\n, red = %d\n, green = %d\n, blue = %d\n\n", i, colorPal[i].r, colorPal[i].g, colorPal[i].b); } #endif break; case MSG_PAINT: { if (g_bShowBall) SendMessage (hWnd, MSG_LBUTTONDOWN, 0, 0); } break; case MSG_LBUTTONDOWN: g_bShowBall = TRUE; hdc = GetClientDC(hWnd); InitMyPalette(myPal); SetPalette(hdc, 0, 256, myPal); SetBrushColor(hdc, COLOR_red); FillCircle(hdc, 10, 10, 8); for (y = 0; y < 240; y += 20) { for (x = 0; x < 320; x += 20) { BitBlt(hdc, 0, 0, 20, 20, hdc, x, y, 0); SetColorfulPalette(hdc); } } ReleaseDC(hdc); break; case MSG_RBUTTONDOWN: SetColorfulPalette(HDC_SCREEN); SetBrushColor(HDC_SCREEN, PIXEL_yellow); FillCircle(HDC_SCREEN, 50, 50, 15); break; case MSG_CLOSE: DestroyAllControls (hWnd); DestroyMainWindow (hWnd); PostQuitMessage (hWnd); return 0; } return DefaultMainWinProc(hWnd, message, wParam, lParam); }
/* main windoww proc */ static int CaptureWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_CREATE: RegisterMybutton(); CreateWindow ("mybutton", "", WS_VISIBLE | WS_CHILD, IDC_MYBUTTON, 110, 80, 70, 20, hWnd, 0); break; case MSG_CLOSE: DestroyAllControls (hWnd); DestroyMainWindow (hWnd); PostQuitMessage (hWnd); return 0; } return DefaultMainWinProc(hWnd, message, wParam, lParam); }
/* main windoww proc */ static int CaretdemoWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { HWND hMyedit; switch (message) { case MSG_CREATE: RegisterMyedit(); hMyedit = CreateWindow("myedit", "", WS_VISIBLE | WS_CHILD, IDC_MYEDIT, 30, 50, 100, 20, hWnd, 0); SetFocus(hMyedit); break; case MSG_CLOSE: DestroyAllControls (hWnd); DestroyMainWindow (hWnd); PostQuitMessage (hWnd); return 0; } return DefaultMainWinProc(hWnd, message, wParam, lParam); }
static int InitDialogBoxProc (HWND hDlg, int message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_INITDIALOG: RECT rc; GetWindowRect ((HWND)(lParam), &rc); MoveWindow (hDlg , (rc.right-rc.left)/2-160 , (rc.bottom-rc.top)/2-60 , 320 , 120 , TRUE); init_parameter_for_find(hDlg); SetNotificationCallback (GetDlgItem (hDlg, IDC_FIND_TEXT), text_string_notif_proc); SetNotificationCallback (GetDlgItem (hDlg, IDC_FIND_CASE), case_sensitive_notif_proc); SetNotificationCallback (GetDlgItem (hDlg, IDC_FIND_WRAP), wrap_notif_proc); SetNotificationCallback (GetDlgItem (hDlg, IDC_FIND_ALL), mark_all_notif_proc); SetNotificationCallback (GetDlgItem (hDlg, IDC_FIND_UP), forward_notif_proc); SetNotificationCallback (GetDlgItem (hDlg, IDC_FIND_DOWN), forward_notif_proc); return 1; case MSG_COMMAND: switch (wParam) { case IDC_FIND_NEXT: { HWND mdolphin_chwnd = get_current_mdolphin_hwnd(); if (mdolphin_chwnd) search_for(mdolphin_chwnd); } break; } break; case MSG_DESTROY: DestroyAllControls(hDlg); return 0; case MSG_CLOSE: { canCreateFindWindow = TRUE; SetWindowText (status_hwnd, ""); SendMessage(propsheet_hwnd, PSM_SHEETCMD, USER_PMS_CLOSE_SEARCHFOR, 0); DestroyMainWindowIndirect(hDlg); } return 0; } return DefaultWindowProc (hDlg, message, wParam, lParam); }
/******************************************************************************************** * Function Name: KeyBoardPro() * Function Discription: Processing function of the KeyBoard window ********************************************************************************************/ static int KeyBoardPro (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { HWND Kbs, Kbb; static char Text[100], PhoneNum[40]; switch (message) { case MSG_CREATE: //創建鍵盤控件 CreateKbd(hWnd); break; case MSG_COMMAND: //鍵盤事件觸發 { int id = LOWORD(wParam); int keyid = HIWORD(wParam); int KeyValue = KeyV[keyid]; if (id == IDC_KB) { //其它按鍵觸發時,發送鍵盤按鍵消息 SendMessage(InputEdit, MSG_KEYDOWN, KeyValue, 0L); } } break; //用於在銷毀時退出的代碼,重要不然會死掉。 case MSG_DESTROY: DestroyAllControls(hWnd); return 0; case MSG_CLOSE: DestroyMainWindow(hWnd); PostQuitMessage(hWnd); return 0; } return DefaultMainWinProc(hWnd, message, wParam, lParam); }
static void container_reset_content (HWND hWnd, PCONTDATA pcontdata) { DestroyAllControls (hWnd); }
static int ControlTestWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_CREATE: { int i; COOLBARITEMINFO cbii; HWND coolbar1, coolbar2, coolbar3, coolbar4; coolbar1 = CreateWindow (CTRL_COOLBAR, "", WS_CHILD | WS_VISIBLE | CBS_BMP_CUSTOM, IDC_COOLBAR1, 0, 0, 52 * (NM_BARPIC + 1), 0, hWnd, MAKELONG (48, 48)); coolbar2 = CreateWindow (CTRL_COOLBAR, "", WS_CHILD | WS_VISIBLE | CBS_BMP_32X32, IDC_COOLBAR2, 0, 100, 36 * (NM_BARPIC + 1), 0, hWnd, 0); coolbar3 = CreateWindow (CTRL_COOLBAR, "", WS_CHILD | WS_VISIBLE, IDC_COOLBAR3, 0, 230, 20 * (NM_BARPIC + 1), 0, hWnd, 0); coolbar4 = CreateWindow (CTRL_COOLBAR, "res/bkgnd.gif", WS_CHILD | WS_VISIBLE | CBS_USEBKBMP | CBS_BMP_CUSTOM, IDC_COOLBAR4, 0, 170, 240, 0, hWnd, MAKELONG (20, 20)); for (i = 0; i < NM_BARPIC; i++) { LoadBitmapFromFile (HDC_SCREEN, bmps+i, barpic[i]); cbii.id = IDC_BAR + i + 1; cbii.ItemType = TYPE_BMPITEM; cbii.Bmp = bmps + i; cbii.ItemHint = barhint[i]; cbii.Caption = NULL; cbii.dwAddData = 0; SendMessage (coolbar1, CBM_ADDITEM, 0, (LPARAM)&cbii); SendMessage (coolbar2, CBM_ADDITEM, 0, (LPARAM)&cbii); SendMessage (coolbar3, CBM_ADDITEM, 0, (LPARAM)&cbii); if (i == 3) { cbii.ItemType = TYPE_BARITEM; SendMessage (coolbar4, CBM_ADDITEM, 0, (LPARAM)&cbii); } if (i >= 3) { cbii.ItemType = TYPE_TEXTITEM; cbii.Bmp = NULL; cbii.ItemHint = barhint[i]; cbii.Caption = barhint[i]; cbii.dwAddData = 0; } SendMessage (coolbar4, CBM_ADDITEM, 0, (LPARAM)&cbii); } break; } case MSG_COMMAND: { #if 0 int id = LOWORD (wParam); int nc = HIWORD (wParam); #endif break; } case MSG_DESTROY: { int i; for (i = 0; i < 6; i++) UnloadBitmap (bmps+i); hMainWnd = HWND_INVALID; return 0; } case MSG_CLOSE: DestroyAllControls (hWnd); DestroyMainWindow (hWnd); MainWindowCleanup (hWnd); return 0; default: break; } return DefaultMainWinProc (hWnd, message, wParam, lParam); }
static int CallWinProc(HWND hcwd, int message, WPARAM wParam, LPARAM lParam) { HWND Kb; switch (message) { case MSG_CREATE: CreateWindow(CTRL_STATIC, MSG_INPUT_NUMBER, WS_VISIBLE, IDC_STA, 0, 0, 80, 20, hcwd, 0); CreateWindow(CTRL_STATIC, "", WS_VISIBLE, IDC_STAW, 100, 20, 120, 20, hcwd, 0); hedit = CreateWindow(CTRL_EDIT, "", WS_CHILD | WS_VISIBLE | WS_BORDER, IDC_EDIT, 100, 0, 120, 20, hcwd, 0); SetNotificationCallback(GetDlgItem(hcwd, IDC_EDIT), ContactNotifProc); /*CreateWindow ( CTRL_BUTTON, "編輯", WS_CHILD|WS_VISIBLE, IDC_MAKE, 120,50,65,20, hcwd, 0);*/ CreateWindow( CTRL_BUTTON, MSG_OK, WS_CHILD | WS_VISIBLE, IDC_OK, 50, 50, 65, 20, hcwd, 0); CreateWindow( CTRL_BUTTON, MSG_PHONEBOOK, WS_CHILD | WS_VISIBLE, IDC_BOOK, 255, 0, 65, 30, hcwd, 0); CreateWindow( CTRL_BUTTON, MSG_CANCEL, WS_CHILD | WS_VISIBLE, IDC_CANCEL, 190, 50, 65, 20, hcwd, 0); CreateWindow( CTRL_BUTTON, "1", WS_CHILD | WS_VISIBLE, IDC_NUM1, 50, 80, 65, 20, hcwd, 0); CreateWindow( CTRL_BUTTON, "2", WS_CHILD | WS_VISIBLE, IDC_NUM2, 120, 80, 65, 20, hcwd, 0); CreateWindow( CTRL_BUTTON, "3", WS_CHILD | WS_VISIBLE, IDC_NUM3, 190, 80, 65, 20, hcwd, 0); CreateWindow( CTRL_BUTTON, "4", WS_CHILD | WS_VISIBLE, IDC_NUM4, 50, 110, 65, 20, hcwd, 0); CreateWindow( CTRL_BUTTON, "5", WS_CHILD | WS_VISIBLE, IDC_NUM5, 120, 110, 65, 20, hcwd, 0); CreateWindow( CTRL_BUTTON, "6", WS_CHILD | WS_VISIBLE, IDC_NUM6, 190, 110, 65, 20, hcwd, 0); CreateWindow( CTRL_BUTTON, "7", WS_CHILD | WS_VISIBLE, IDC_NUM7, 50, 140, 65, 20, hcwd, 0); CreateWindow( CTRL_BUTTON, "8", WS_CHILD | WS_VISIBLE, IDC_NUM8, 120, 140, 65, 20, hcwd, 0); CreateWindow( CTRL_BUTTON, "9", WS_CHILD | WS_VISIBLE, IDC_NUM9, 190, 140, 65, 20, hcwd, 0); CreateWindow( CTRL_BUTTON, "*", WS_CHILD | WS_VISIBLE, IDC_NUMX, 50, 170, 65, 20, hcwd, 0); CreateWindow( CTRL_BUTTON, "0", WS_CHILD | WS_VISIBLE, IDC_NUM0, 120, 170, 65, 20, hcwd, 0); CreateWindow( CTRL_BUTTON, "#", WS_CHILD | WS_VISIBLE, IDC_NUMY, 190, 170, 65, 20, hcwd, 0); CreateWindow( CTRL_BUTTON, MSG_EXIT, WS_CHILD | WS_VISIBLE, IDC_NUMQ, 0, 190, 65, 30, hcwd, 0); /* CreateWindow ( CTRL_BUTTON, "軟鍵盤", WS_CHILD|WS_VISIBLE, IDC_NUMS, 255,190,65,30, hcwd, 0); */ SetTimer(hcwd, _IDC_TIMER, 100); break; case MSG_TIMER: { if (wParam == _IDC_TIMER) { if (flag) { T++; maintime = maintime + T; sprintf(buffer, "%02d:%02d:%02d", T / 3600, (T % 3600) / 60, (T % 3600) % 60); SetWindowText(GetDlgItem(hcwd, IDC_STAW), buffer); } } } case MSG_COMMAND: { switch (wParam) { case IDC_NUM1: SendMessage(GetDlgItem(hcwd, IDC_NUM1), MSG_GETTEXT, 1, (LPARAM)buff1); strcat(buff, buff1); SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, 1, (LPARAM)buff); break; case IDC_NUM2: SendMessage(GetDlgItem(hcwd, IDC_NUM2), MSG_GETTEXT, 1, (LPARAM)buff1); strcat(buff, buff1); SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, 1, (LPARAM)buff); break; case IDC_NUM3: SendMessage(GetDlgItem(hcwd, IDC_NUM3), MSG_GETTEXT, 1, (LPARAM)buff1); strcat(buff, buff1); SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, 1, (LPARAM)buff); break; case IDC_NUM4: SendMessage(GetDlgItem(hcwd, IDC_NUM4), MSG_GETTEXT, 1, (LPARAM)buff1); strcat(buff, buff1); SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, 1, (LPARAM)buff); break; case IDC_NUM5: SendMessage(GetDlgItem(hcwd, IDC_NUM5), MSG_GETTEXT, 1, (LPARAM)buff1); strcat(buff, buff1); SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, 1, (LPARAM)buff); break; case IDC_NUM6: SendMessage(GetDlgItem(hcwd, IDC_NUM6), MSG_GETTEXT, 1, (LPARAM)buff1); strcat(buff, buff1); SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, 1, (LPARAM)buff); break; case IDC_NUM7: SendMessage(GetDlgItem(hcwd, IDC_NUM7), MSG_GETTEXT, 1, (LPARAM)buff1); strcat(buff, buff1); SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, 1, (LPARAM)buff); break; case IDC_NUM8: SendMessage(GetDlgItem(hcwd, IDC_NUM8), MSG_GETTEXT, 1, (LPARAM)buff1); strcat(buff, buff1); SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, 1, (LPARAM)buff); break; case IDC_NUM9: SendMessage(GetDlgItem(hcwd, IDC_NUM9), MSG_GETTEXT, 1, (LPARAM)buff1); strcat(buff, buff1); SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, 1, (LPARAM)buff); break; case IDC_NUMX: SendMessage(GetDlgItem(hcwd, IDC_NUMX), MSG_GETTEXT, 1, (LPARAM)buff1); strcat(buff, buff1); SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, 1, (LPARAM)buff); break; case IDC_NUM0: SendMessage(GetDlgItem(hcwd, IDC_NUM0), MSG_GETTEXT, 1, (LPARAM)buff1); strcat(buff, buff1); SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, 1, (LPARAM)buff); break; case IDC_NUMY: SendMessage(GetDlgItem(hcwd, IDC_NUMY), MSG_GETTEXT, 1, (LPARAM)buff1); strcat(buff, buff1); SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, 1, (LPARAM)buff); break; case IDC_BOOK: Menu(); break; case IDC_OK: flag = 1; if (flagcall == 1) { if (flag_call_ans == 1) { gprs_ans(); flagcall = 0; } if (buff[0] != '\0') { gprs_call(buff, strlen(buff)); strcpy(buff, MSG_DIAL); SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, 0, (LPARAM)buff); flagcall = 0; } } break; case IDC_CANCEL: flag = 0; T = 0; sprintf(buffer1, "%02d:%02d:%02d", 0, 0, 0); SetWindowText(GetDlgItem(hcwd, IDC_STAW), buffer1); fp = fopen(FILE_LAST_TIME_DAT, "w"); fwrite(buffer, sizeof(buffer), 1, fp); fclose(fp); if (flagcall == 0) { gprs_hold(); flagcall = 1; strcpy(buff, MSG_HUNG_UP); SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, 0, (LPARAM)buff); } else { i = strlen(buff); buff[i - 1] = '\0'; SendMessage(GetDlgItem(hcwd, IDC_EDIT), MSG_SETTEXT, i - 1, (LPARAM)buff); } break; case IDC_NUMQ: flag = 0; T = 0; KillTimer(hcwd, _IDC_TIMER); //DestroyMainWindow (hcwd); //PostQuitMessage (hcwd); ShowWindow(hcwd, SW_HIDE); break; /* case IDC_NUMS: if(KBOn==0) { KBOn = 1; CreateKeyBoard(hcwd); } else { KBOn = 0; Kb = GetFirstHosted(hcwd); DestroyAllControls (Kb); DestroyMainWindow (Kb); PostQuitMessage (Kb); } break; */ default: break; } } break; case MSG_TAG: ShowWindow(hcwd, SW_SHOWNORMAL); break; case MSG_RING: ShowWindow(hcwd, SW_SHOWNORMAL); if (IDYES == MessageBox(hcwd, MSG_PHONE_CALL, MSG_INDICATION, MB_YESNO)) { flag_call_ans = 1; flagcall == 1; } else { gprs_hold(); } return 0; case MSG_DESTROY: DestroyAllControls(hcwd); return 0; case MSG_CLOSE: flag = 0; T = 0; KillTimer(hcwd, _IDC_TIMER); DestroyMainWindow(hcwd); PostQuitMessage(hcwd); return 0; } return DefaultMainWinProc(hcwd, message, wParam, lParam); }
static int ControlTestWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_CREATE: create_combobox (hWnd); CreateWindow (CTRL_STATIC, selected_, WS_CHILD | WS_VISIBLE | SS_SIMPLE, IDC_SELECTED, 210, 10, 200, 25, hWnd, 0); CreateWindow (CTRL_BUTTON, Close, WS_CHILD | WS_VISIBLE, IDCANCEL, 320, 190, 60, 25, hWnd, 0); break; case MSG_COMMAND: { int id = LOWORD(wParam); int code = HIWORD(wParam); char str [NAME_MAX + 20], file [NAME_MAX + 1]; int selected; if (wParam == IDCANCEL) { PostMessage (hWnd, MSG_CLOSE, 0, 0); break; } switch (id) { case IDC_BOX1: if (code != CBN_SELCHANGE) break; selected = SendDlgItemMessage (hWnd, IDC_BOX1, CB_GETCURSEL,0,0); if (selected >= 0) { SendDlgItemMessage (hWnd, IDC_BOX1, CB_GETLBTEXT, selected, (LPARAM)file); if (strlen (file)) { sprintf (str, "Selected: %s", file); SetDlgItemText (hWnd, IDC_SELECTED, str); } } break; } } break; case MSG_DESTROY: DestroyAllControls (hWnd); hMainWnd = HWND_INVALID; return 0; case MSG_CLOSE: DestroyMainWindow (hWnd); MainWindowThreadCleanup (hWnd); return 0; } return DefaultMainWinProc(hWnd, message, wParam, lParam); }
static int CounterDialogProc(HWND hcwd, int message, WPARAM wParam, LPARAM lParam) { HDC hdc; RECT rc; int itemcount, i; char buffer1[Max]; char buffer2[Max]; static char buffer3[Max]; static float tal; static float tall; static float sum; char *str; static char ter1[Max] = {'+', '\0'}; static char ter2[Max] = {'-', '\0'}; static char ter3[Max] = {'*', '\0'}; static char ter4[Max] = {'/', '\0'}; switch (message) { case MSG_CREATE: flag1 = 0; CreateWindow(CTRL_EDIT, "", WS_VISIBLE | WS_BORDER | ES_RIGHT, IDC_INPUT1, 15, 10, 280, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, MSG_RETURN, WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_RET1, 15, 45, 80, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "C", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_RET2, 105, 45, 80, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "9", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INPUT2, 15, 80, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "8", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INPUT3, 85, 80, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "7", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INPUT4, 155, 80, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "+", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INPUT5, 225, 80, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "6", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INPUT6, 15, 115, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "5", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INPUT7, 85, 115, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "4", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INPUT8, 155, 115, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "-", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INPUT9, 225, 115, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "3", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INSERT, 15, 150, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "2", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INSERT1, 85, 150, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "1", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INSERT2, 155, 150, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "*", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INSERT3, 225, 150, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "0", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INSERT4, 15, 185, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, ".", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INSERT5, 85, 185, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "/", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INSERT6, 155, 185, 60, 25, hcwd, 0); CreateWindow(CTRL_BUTTON, "=", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_INSERT7, 195, 45, 80, 25, hcwd, 0); break; case MSG_COMMAND: { switch (wParam) { case IDC_INPUT2: if (flag3 == 1) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); strcpy(buffer1, "9"); strcat(buffer2, buffer1); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag3 = 0; return 0; case IDC_INPUT3: if (flag3 == 1) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); strcpy(buffer1, "8"); strcat(buffer2, buffer1); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag3 = 0; return 0; case IDC_INPUT4: if (flag3 == 1) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); strcpy(buffer1, "7"); strcat(buffer2, buffer1); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag3 = 0; return 0; case IDC_INPUT6: if (flag3 == 1) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); strcpy(buffer1, "6"); strcat(buffer2, buffer1); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag3 = 0; return 0; case IDC_INPUT7: if (flag3 == 1) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); strcpy(buffer1, "5"); strcat(buffer2, buffer1); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag3 = 0; return 0; case IDC_INPUT8: if (flag3 == 1) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); strcpy(buffer1, "4"); strcat(buffer2, buffer1); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag3 = 0; return 0; case IDC_INSERT: if (flag3 == 1) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); strcpy(buffer1, "3"); strcat(buffer2, buffer1); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag3 = 0; return 0; case IDC_INSERT1: if (flag3 == 1) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); strcpy(buffer1, "2"); strcat(buffer2, buffer1); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag3 = 0; return 0; case IDC_INSERT2: if (flag3 == 1) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); strcpy(buffer1, "1"); strcat(buffer2, buffer1); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag3 = 0; return 0; case IDC_INSERT4: if (flag3 == 1) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } if (strcmp(buffer3, ter4) != 0) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); strcpy(buffer1, "0"); strcat(buffer2, buffer1); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag3 = 0; } return 0; case IDC_INSERT5: if (flag1 == 0) { flag1 = 1; GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); if (buffer2[0] == '\0') { strcpy(buffer1, "0"); strcat(buffer2, buffer1); strcpy(buffer1, "."); strcat(buffer2, buffer1); } else { strcpy(buffer1, "."); strcat(buffer2, buffer1); } SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } return 0; case IDC_INPUT5: if (flag2 == 1) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); str = buffer2; tal = atof(str); if (strcmp(buffer3, ter1) == 0) { sum = tall + tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter2) == 0) { sum = tall - tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter3) == 0) { sum = tall * tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter4) == 0) { sum = tall / tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } } GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); str = buffer2; tall = atof(str); strcpy(buffer3, "+"); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag1 = 0; flag2 = 1; return 0; case IDC_INPUT9: if (flag2 == 1) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); str = buffer2; tal = atof(str); if (strcmp(buffer3, ter1) == 0) { sum = tall + tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter2) == 0) { sum = tall - tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter3) == 0) { sum = tall * tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter4) == 0) { sum = tall / tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } } GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); str = buffer2; tall = atof(str); strcpy(buffer3, "-"); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag1 = 0; return 0; case IDC_INSERT3: if (flag2 == 1) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); str = buffer2; tal = atof(str); if (strcmp(buffer3, ter1) == 0) { sum = tall + tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter2) == 0) { sum = tall - tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter3) == 0) { sum = tall * tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter4) == 0) { sum = tall / tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } } GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); str = buffer2; tall = atof(str); strcpy(buffer3, "*"); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag1 = 0; return 0; case IDC_INSERT6: if (flag2 == 1) { GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); str = buffer2; tal = atof(str); if (strcmp(buffer3, ter1) == 0) { sum = tall + tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter2) == 0) { sum = tall - tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter3) == 0) { sum = tall * tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter4) == 0) { sum = tall / tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } } GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); str = buffer2; tall = atof(str); strcpy(buffer3, "/"); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag1 = 0; return 0; case IDC_INSERT7: GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); str = buffer2; //MessageBox(0,str,"",MB_OK); //MessageBox(0,buffer1,"",MB_OK); //printf("%f",tall); tal = atof(str); flag1 = 1; if (strcmp(buffer3, ter1) == 0) { sum = tall + tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter2) == 0) { sum = tall - tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter3) == 0) { sum = tall * tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } else if (strcmp(buffer3, ter4) == 0) { sum = tall / tal; sprintf(buffer2, "%f", sum); SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); } flag2 = 0; flag3 = 1; return 0; case IDC_RET2: GetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2, Max); buffer2[0] = '\0'; SetWindowText(GetDlgItem(hcwd, IDC_INPUT1), buffer2); flag1 = 0; return 0; case IDC_RET1: //DestroyAllControls(hcwd); DestroyMainWindow(hcwd); PostQuitMessage(hcwd); return 0; } } break; case MSG_DESTROY: DestroyAllControls(hcwd); return 0; case MSG_CLOSE: DestroyMainWindow(hcwd); PostQuitMessage(hcwd); return 0; } return DefaultMainWinProc(hcwd, message, wParam, lParam); }
static int Verifywinproc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { HDC hdc; int id,nc, tmpvalue = 0; static char keyupFlag=0; switch (message) { case MSG_CREATE: InitWindow(hWnd); SetFocusChild(editacno3); SetWindowText(editacno3,propin); SendMessage(editacno3,EM_SETCARETPOS,0,1); return 0; case MSG_PAINT: hdc=BeginPaint(hWnd); tmpvalue= SetBkMode(hdc,BM_TRANSPARENT); SetTextColor(hdc,PIXEL_lightwhite); TextOut(hdc,60,70,LoadStrByID(HID_PLACEFINGER)); EndPaint(hWnd,hdc); return 0; case MSG_KEYUP: if(3 == gOptions.TFTKeyLayout) { keyupFlag=1; } break; case MSG_KEYDOWN: SetMenuTimeOut(time(NULL)); if(3 == gOptions.TFTKeyLayout) { if(1==keyupFlag) keyupFlag=0; else break; } if ((GetFocusChild(hWnd)==editacno3)&&((LOWORD(wParam)==SCANCODE_ENTER) ||(LOWORD(wParam)==SCANCODE_F10))) procverifychoose(hWnd); if ((LOWORD(wParam)==SCANCODE_ESCAPE)) PostMessage (hWnd, MSG_CLOSE, 0, 0L); break; case MSG_DESTROY: DestroyAllControls (hWnd); hMainWnd1 = HWND_INVALID; return 0; case MSG_CLOSE: DestroyMainWindow(hWnd); MainWindowThreadCleanup (hWnd); return 0; case MSG_COMMAND: id = LOWORD(wParam); nc = HIWORD(wParam); if (id==ID_ACNO) { if (nc==EN_CHANGE) { memset(propin,0,24); GetWindowText (editacno3, propin, 24); printf("keybuffer:%s\n",propin); } } break; } return DefaultMainWinProc(hWnd,message,wParam,lParam); }
static int SaveFileProc(HWND hDlg,int message,WPARAM wParam,LPARAM lParam) { char pathname[30]={0}; char name[20]; int xTmp,yTmp; int code,id; pid_t p_ret; switch (message){ case MSG_INITDIALOG: create_coolbar_num(hDlg); create_coolbar_qwe(hDlg); create_coolbar_asd(hDlg); create_coolbar_zxc(hDlg); hWndTmp=GetDlgItem(hDlg,IDC_FILENAME); /* p_ret=vfork(); if(p_ret==-1) { perror("vfork()"); exit(0); } else if(p_ret==0) //表示子进程 { printf("this is child. pid of child is: %d\n",getpid()); if(execlp("mount","mount","/dev/sda[a-z][0-9]","/mnt/udisk",NULL)<0) perror("execlp mount"); printf("mount success!"); } else { printf("this is father.pid of child is: %d\n",p_ret); waitpid(p_ret,NULL,0); printf("mount child is over\n"); } */ return 1; case MSG_LBUTTONDOWN: xTmp=LOWORD(lParam); yTmp=HIWORD(lParam); if((xTmp>=50) && (xTmp<180)) { if((yTmp>=50)&& (yTmp<75)) hWndTmp=GetDlgItem(hDlg,IDC_FILENAME); } break; case MSG_COMMAND: id=LOWORD(wParam); code=HIWORD(wParam); switch(id) { case IDC_FILENAME: if(HIWORD(wParam) !=EN_ENTER) break; case IDC_CB_NUM: PostMessage(hWndTmp,MSG_CHAR,'0'+code,0); break; case IDC_CB_QWE: PostMessage (hWndTmp, MSG_CHAR, caption2[code][0], 0); break; case IDC_CB_ASD: PostMessage (hWndTmp, MSG_CHAR, caption3[code][0], 0); break; case IDC_CB_ZXC: if(code != 9) PostMessage (hWndTmp, MSG_CHAR, caption4[code][0], 0); else PostMessage(hWndTmp,MSG_SETTEXT,0,(LPARAM)pStr); break; case IDOK: GetWindowText(GetDlgItem(hDlg,IDC_FILENAME),name,30); strcpy(pathname,"/mnt/udisk/"); strcat(pathname,name); strcat(pathname,".txt"); /* if(strlen(name)==0) { MessageBox(hDlg,"文件名不能为空","输入有误",MB_OK|MB_ICONHAND); break; } */ // sprintf(name,%f.txt,); /********************************************************************************* rc1 = sqlite3_open("login.db",&db1); if(rc1){ fprintf(stderr,"Can't open database:%s\n",sqlite3_errmsg(db1)); } sql3 = sqlite3_mprintf("alter table login_table rename to %s",name); sqlite3_exec(db1,sql3,0,0,&errmsg1); sqlite3_free(sql3); sqlite3_close(db1); // rename("login.db","/mnt/udisk/login.db"); ********************************************************************************/ p_ret=vfork(); if(p_ret == -1) { perror("vfork()"); exit(0); } else if(p_ret == 0) { // if(execlp("cp","cp","/tmp/login.txt","/mnt/udisk/",NULL)<0) if(execlp("cp","cp","/tmp/login.txt",pathname,NULL)<0) perror("excelp mv login.db"); } else { waitpid(p_ret,NULL,0); MessageBox(hDlg,"保存成功","文件保存",MB_OK); } sync(); //一定要执行这一步,否则热插拔会出问题 /*执行umount命令卸载U盘*/ /* p_ret=vfork(); if(p_ret==-1) { perror("vfork()"); exit(0); } else if(p_ret==0) //表示子进程 { printf("this is child.pid of child is: %d\n",getpid()); if(execlp("umount","umount","/mnt/udisk",NULL)<0) perror("execlp mount"); printf("umount success!"); } else { printf("this is father.pid of child is: %d\n",p_ret); waitpid(p_ret,NULL,0); printf("umount child is over\n"); } */ EndDialog(hDlg,wParam); DestroyAllControls(hDlg); break; case IDCANCEL: EndDialog(hDlg,wParam); DestroyAllControls(hDlg); break; default: break; } break; default: break; } return DefaultDialogProc(hDlg,message,wParam,lParam); }
int SameGameProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_CREATE: { RECT rcClient; MENUBUTTONITEM mbi; GetClientRect (hWnd, &rcClient); CreateWindow (CTRL_STATIC, SM_ST_SCENARIO, WS_CHILD | WS_VISIBLE | SS_RIGHT, 0, 0, rcClient.bottom - GetSysCharHeight () - 4, 100, GetSysCharHeight () + 4, hWnd, 0); hwnd_menu = CreateWindow ("menubutton", SM_ST_MNB, WS_CHILD | WS_VISIBLE, 100, 100, rcClient.bottom - GetSysCharHeight () - 4, 100, GetSysCharHeight () + 4, hWnd, 0); if (fill_menu (hwnd_menu) <= 0) { fprintf (stderr, "Can not find scenario.\n"); return -1; } SendMessage (hwnd_menu, MBM_SETCURITEM, 0, 0); hwnd_score = CreateWindow (CTRL_STATIC, SM_ST_SETSCORE, WS_CHILD | WS_VISIBLE | SS_RIGHT, 0, 200, rcClient.bottom - GetSysCharHeight () - 4, rcClient.right - 200, GetSysCharHeight () + 4, hWnd, 0); mbi.which = MB_WHICH_TEXT; SendMessage (hwnd_menu, MBM_GETITEMDATA, 0, (LPARAM)&mbi); create_same_board (mbi.text); new_game (hWnd); } break; case MSG_COMMAND: if (LOWORD(wParam) == 100 && HIWORD (wParam) == MBN_CHANGED) { int sel = SendMessage (hwnd_menu, MBM_GETCURITEM, 0, 0); if (sel >= 0) sel_scenario (hWnd, sel); break; } switch (wParam) { case IDM_NEW: new_game (hWnd); break; case IDM_SCORES: break; case IDM_EXIT: SendMessage (hWnd, MSG_CLOSE, 0, 0L); break; case IDM_PREF: break; case IDM_ABOUT: break; } break; case MSG_PAINT: { HDC hdc; hdc = BeginPaint (hWnd); paint (hWnd, hdc); EndPaint (hWnd, hdc); return 0; } case MSG_LBUTTONDOWN: { int x = LOWORD (lParam); int y = HIWORD (lParam); kill_balls (hWnd, x / STONE_SIZE, y / STONE_SIZE); old_x = -1; old_y = -1; } break; case MSG_MOUSEMOVE: { int x = LOWORD (lParam); int y = HIWORD (lParam); if (PtInRect (&rcBoard, x, y)) mark_balls (hWnd, x / STONE_SIZE, y / STONE_SIZE); else unmark_balls (hWnd); } break; case MSG_NCMOUSEMOVE: if (wParam != HT_CLIENT) unmark_balls (hWnd); break; case MSG_MOUSEMOVEIN: if (!wParam) unmark_balls (hWnd); break; case MSG_TIMER: if (wParam == ID_TIMER) { HDC hdc = GetClientDC (hWnd); move_tagged_balls (hdc); ReleaseDC (hdc); } break; case MSG_CLOSE: if (MessageBox (hWnd, SM_ST_QUIT, SM_ST_SAME, MB_YESNO | MB_ICONQUESTION | MB_BASEDONPARENT) != IDYES) return 0; DestroyAllControls (hWnd); DestroyMainWindow (hWnd); PostQuitMessage (hWnd); return 0; } return DefaultMainWinProc (hWnd, message, wParam, lParam); }
static int ControlTestWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { static BITMAP folder; switch (message) { case MSG_CREATE: { create_ctrls (hWnd); hRightMenu = create_rightbutton_menu (); LoadBitmapFromFile (HDC_SCREEN, &folder, "./res/folder.bmp"); hChildWnd1 = CreateWindow (CTRL_GRID, "GRID", WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | WS_BORDER, IDC_GRID, 20, 20, 350, 200, hWnd, 0); } break; case MSG_COMMAND: { int id = LOWORD (wParam); //int code = HIWORD (wParam); int nSel, col, row; char buffer[101]; GetWindowText (GetDlgItem(hWnd, IDC_EDIT), buffer, 100); nSel = atoi(buffer); switch (id) { case IDC_CTRL1: row = SendMessage(hChildWnd1, GRIDM_GETHEADHEIGHT, 0,0); sprintf(buffer, "%d", row); SetWindowText(GetDlgItem(hWnd, IDC_EDIT), buffer); break; case IDC_CTRL2: col = SendMessage(hChildWnd1, GRIDM_GETHEADWIDTH, 0,0); sprintf(buffer, "%d", col); SetWindowText(GetDlgItem(hWnd, IDC_EDIT), buffer); break; case IDC_CTRL3: col = SendMessage(hChildWnd1, GRIDM_GETCOLCOUNT, 0, 0); SendMessage(hChildWnd1, GRIDM_ADDCOL, (WPARAM)col, 0); break; case IDC_CTRL4: col = SendMessage(hChildWnd1, GRIDM_GETCOLCOUNT, 0, 0); SendMessage(hChildWnd1, GRIDM_DELCOL, (WPARAM)(col-1), 0); break; case IDC_CTRL6: break; case IDC_CTRL7: break; case IDC_CTRL8: break; case IDC_CTRL9: break; case IDM_FILE ... IDM_FILE+4: MessageBox (hMainWnd, "In Construction ...", "Sorry", MB_OK); break; } } break; case MSG_DESTROY: UnloadBitmap (&folder); DestroyMenu (hRightMenu); DestroyAllControls (hWnd); hMainWnd = HWND_INVALID; return 0; case MSG_CLOSE: DestroyMainWindow (hWnd); MainWindowCleanup (hWnd); return 0; } return DefaultMainWinProc (hWnd, message, wParam, lParam); }