HWND CreateListView(HINSTANCE hInstance, HWND hWndParent) { INITCOMMONCONTROLSEX icex; HWND hWnd; RECT rc; LVCOLUMN lvc; icex.dwSize = sizeof(icex); icex.dwICC = ICC_LISTVIEW_CLASSES; InitCommonControlsEx(&icex); GetClientRect(hWndParent, &rc); hWnd = CreateWindow(WC_LISTVIEW, _T(""), WS_CHILD | LVS_REPORT, 0, 0, rc.right - rc.left, rc.bottom - rc.top, hWndParent, NULL, hInstance, NULL); if (hWnd == NULL) return NULL; lvc.mask = LVCF_WIDTH | LVCF_TEXT; lvc.cx = 100; lvc.pszText = _T("Name"); ListView_InsertColumn(hWnd, 0, &lvc); lvc.pszText = _T("Type"); ListView_InsertColumn(hWnd, 1, &lvc); lvc.pszText = _T("Status"); ListView_InsertColumn(hWnd, 2, &lvc); UpdateListView(hWnd); return hWnd; }
void ClipBitmapStyleTransformer::PropertyChanged(const wxPGProperty* pProperty) { const ClipBitmapStyle* pClipBitmapStyle = GetSelectedClipBitmapStyle(); if (!pClipBitmapStyle) return; bool bRedraw = false; if (pProperty->GetName() == wxT("id")) { wxString strNewId = pProperty->GetValueAsString(); if (ClipBitmapStyleDocument::GetInstance().RenameClipBitmapStyleId(pClipBitmapStyle, strNewId)) { UpdateListView(); m_bSkipUpdateProperty = true; SetSelectedClipBitmapStyle(pClipBitmapStyle); m_bSkipUpdateProperty = false; } } else if (pProperty->GetName() == wxT("auto_bitmap")) { bool bAutoGenBitmap = pProperty->GetValue().GetBool(); bRedraw = ClipBitmapStyleDocument::GetInstance().SetAutoGenBitmap(pClipBitmapStyle, bAutoGenBitmap); } else if (pProperty->GetName() == wxT("normal")) { wxString strNewPieceId = pProperty->GetValueAsString(); bRedraw = ClipBitmapStyleDocument::GetInstance().SetStatePiece(pClipBitmapStyle, ImagePieceDocument::GetInstance().FindPieceInfo(strNewPieceId), IStyle::SS_NORMAL); } else if (pProperty->GetName() == wxT("down")) { wxString strNewPieceId = pProperty->GetValueAsString(); bRedraw = ClipBitmapStyleDocument::GetInstance().SetStatePiece(pClipBitmapStyle, ImagePieceDocument::GetInstance().FindPieceInfo(strNewPieceId), IStyle::SS_DOWN); } else if (pProperty->GetName() == wxT("hover")) { wxString strNewPieceId = pProperty->GetValueAsString(); bRedraw = ClipBitmapStyleDocument::GetInstance().SetStatePiece(pClipBitmapStyle, ImagePieceDocument::GetInstance().FindPieceInfo(strNewPieceId), IStyle::SS_HOVER); } else if (pProperty->GetName() == wxT("disabled")) { wxString strNewPieceId = pProperty->GetValueAsString(); bRedraw = ClipBitmapStyleDocument::GetInstance().SetStatePiece(pClipBitmapStyle, ImagePieceDocument::GetInstance().FindPieceInfo(strNewPieceId), IStyle::SS_DISABLED); } if (bRedraw) { ClipBitmapStyleEditor::GetInstance().SetClipBitmapStyle(NULL); ClipBitmapStyleEditor::GetInstance().SetClipBitmapStyle(pClipBitmapStyle); } }
void ColorStyleTransformer::PropertyChanged(const wxPGProperty* pProperty) { const ColorStyle* pColorStyle = GetSelectedColorStyle(); if (!pColorStyle) return; bool bRedraw = false; if (pProperty->GetName() == wxT("id")) { wxString strNewId = pProperty->GetValueAsString(); if (ColorStyleDocument::GetInstance().RenameColorStyleId(pColorStyle, strNewId)) { UpdateListView(); m_bSkipUpdateProperty = true; SetSelectedColorStyle(pColorStyle); m_bSkipUpdateProperty = false; } } else if (pProperty->GetName() == wxT("normal")) { wxColour color; color << pProperty->GetValue(); bRedraw = ColorStyleDocument::GetInstance().SetStateColor(pColorStyle, color.GetRGB(), IStyle::SS_NORMAL); } else if (pProperty->GetName() == wxT("down")) { wxColour color; color << pProperty->GetValue(); bRedraw = ColorStyleDocument::GetInstance().SetStateColor(pColorStyle, color.GetRGB(), IStyle::SS_DOWN); } else if (pProperty->GetName() == wxT("hover")) { wxColour color; color << pProperty->GetValue(); bRedraw = ColorStyleDocument::GetInstance().SetStateColor(pColorStyle, color.GetRGB(), IStyle::SS_HOVER); } else if (pProperty->GetName() == wxT("disabled")) { wxColour color; color << pProperty->GetValue(); bRedraw = ColorStyleDocument::GetInstance().SetStateColor(pColorStyle, color.GetRGB(), IStyle::SS_DISABLED); } if (bRedraw) { ColorStyleEditor::GetInstance().SetColorStyle(NULL); ColorStyleEditor::GetInstance().SetColorStyle(pColorStyle); } }
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT res = 0; switch (uMsg) { case WM_CREATE: break; case WM_DESTROY: KillTimer(hWnd, TIMER_ID); break; case WM_TIMER: UpdateListView((HWND) GetWindowLongPtr(hWnd, GWLP_USERDATA)); break; default: res = DefWindowProc(hWnd, uMsg, wParam, lParam); break; } return res; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASS wc; HWND hWnd, hWndListView; MSG msg; BOOL ret; UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); UNREFERENCED_PARAMETER(nCmdShow); ZeroMemory(&wc, sizeof(wc)); wc.lpfnWndProc = WndProc; wc.hInstance = hInstance; wc.lpszClassName = CLASS_NAME; wc.hbrBackground = GetStockObject(WHITE_BRUSH); RegisterClass(&wc); hWnd = CreateWindow(CLASS_NAME, WND_NAME, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); if (hWnd == NULL) return GetLastError(); hWndListView = CreateListView(hInstance, hWnd); if (hWndListView == NULL) return GetLastError(); UpdateListView(hWndListView); SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) hWndListView); SetTimer(hWnd, TIMER_ID, TIMER_INTERVAL_MS, NULL); ShowWindow(hWnd, SW_SHOW); ShowWindow(hWndListView, SW_SHOW); while ((ret = GetMessage(&msg, hWnd, 0, 0)) != 0 && ret != -1) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int)msg.wParam; }
INT_PTR CALLBACK InterfaceDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { CHOOSECOLOR cc; COLORREF choice_colors[16]; TCHAR tmp[4]; int i = 0; BOOL bRedrawList = FALSE; int nCurSelection = 0; int nHistoryTab = 0; int nTabCount = 0; int nPatternCount = 0; int value = 0; const char* snapname = NULL; switch (Msg) { case WM_INITDIALOG: Button_SetCheck(GetDlgItem(hDlg,IDC_START_GAME_CHECK),GetGameCheck()); Button_SetCheck(GetDlgItem(hDlg,IDC_JOY_GUI),GetJoyGUI()); Button_SetCheck(GetDlgItem(hDlg,IDC_KEY_GUI),GetKeyGUI()); Button_SetCheck(GetDlgItem(hDlg,IDC_BROADCAST),GetBroadcast()); Button_SetCheck(GetDlgItem(hDlg,IDC_RANDOM_BG),GetRandomBackground()); Button_SetCheck(GetDlgItem(hDlg,IDC_HIDE_MOUSE),GetHideMouseOnStartup()); // Get the current value of the control SendDlgItemMessage(hDlg, IDC_CYCLETIMESEC, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, 60)); /* [0, 60] */ value = GetCycleScreenshot(); SendDlgItemMessage(hDlg,IDC_CYCLETIMESEC, TBM_SETPOS, TRUE, value); _itot(value,tmp,10); SendDlgItemMessage(hDlg,IDC_CYCLETIMESECTXT,WM_SETTEXT,0, (WPARAM)tmp); Button_SetCheck(GetDlgItem(hDlg,IDC_STRETCH_SCREENSHOT_LARGER), GetStretchScreenShotLarger()); Button_SetCheck(GetDlgItem(hDlg,IDC_FILTER_INHERIT), GetFilterInherit()); Button_SetCheck(GetDlgItem(hDlg,IDC_NOOFFSET_CLONES), GetOffsetClones()); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("Snapshot")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_SCREENSHOT); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("Flyer")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_FLYER); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("Cabinet")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_CABINET); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("Marquee")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_MARQUEE); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("Title")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_TITLE); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("Control Panel")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_CONTROL_PANEL); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("PCB")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_PCB); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("All")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_ALL); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_HISTORY_TAB), TEXT("None")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nTabCount++, TAB_NONE); if (GetHistoryTab() < MAX_TAB_TYPES) { (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_HISTORY_TAB), GetHistoryTab()); } else { (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_HISTORY_TAB), GetHistoryTab()-TAB_SUBTRACT); } (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_SNAPNAME), TEXT("Gamename")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_SNAPNAME), nPatternCount++, "%g"); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_SNAPNAME), TEXT("Gamename + Increment")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_SNAPNAME), nPatternCount++, "%g%i"); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_SNAPNAME), TEXT("Gamename/Gamename")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_SNAPNAME), nPatternCount++, "%g/%g"); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_SNAPNAME), TEXT("Gamename/Gamename + Increment")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_SNAPNAME), nPatternCount++, "%g/%g%i"); (void)ComboBox_AddString(GetDlgItem(hDlg, IDC_SNAPNAME), TEXT("Gamename/Increment")); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_SNAPNAME), nPatternCount, "%g/%i"); //Default to this setting (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_SNAPNAME), nPatternCount++); snapname = GetSnapName(); if (core_stricmp(snapname,"%g" )==0) { (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_SNAPNAME), 0); } if (core_stricmp(snapname,"%g%i" )==0) { (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_SNAPNAME), 1); } if (core_stricmp(snapname,"%g/%g" )==0) { (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_SNAPNAME), 2); } if (core_stricmp(snapname,"%g/%g%i" )==0) { (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_SNAPNAME), 3); } if (core_stricmp(snapname,"%g/%i" )==0) { (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_SNAPNAME), 4); } SendDlgItemMessage(hDlg, IDC_SCREENSHOT_BORDERSIZE, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, 100)); /* [0, 100] */ value = GetScreenshotBorderSize(); SendDlgItemMessage(hDlg,IDC_SCREENSHOT_BORDERSIZE, TBM_SETPOS, TRUE, value); _itot(value,tmp,10); SendDlgItemMessage(hDlg,IDC_SCREENSHOT_BORDERSIZETXT,WM_SETTEXT,0, (WPARAM)tmp); //return TRUE; break; case WM_HELP: /* User clicked the ? from the upper right on a control */ HelpFunction((HWND)((LPHELPINFO)lParam)->hItemHandle, MAMEUICONTEXTHELP, HH_TP_HELP_WM_HELP, GetHelpIDs()); break; case WM_CONTEXTMENU: HelpFunction((HWND)wParam, MAMEUICONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs()); break; case WM_HSCROLL: HANDLE_WM_HSCROLL(hDlg, wParam, lParam, OnHScroll); break; case WM_COMMAND : switch (GET_WM_COMMAND_ID(wParam, lParam)) { case IDC_SCREENSHOT_BORDERCOLOR: { for (i=0;i<16;i++) choice_colors[i] = GetCustomColor(i); cc.lStructSize = sizeof(CHOOSECOLOR); cc.hwndOwner = hDlg; cc.rgbResult = GetScreenshotBorderColor(); cc.lpCustColors = choice_colors; cc.Flags = CC_ANYCOLOR | CC_RGBINIT | CC_SOLIDCOLOR; if (!ChooseColor(&cc)) return TRUE; for (i=0;i<16;i++) SetCustomColor(i,choice_colors[i]); SetScreenshotBorderColor(cc.rgbResult); UpdateScreenShot(); return TRUE; } case IDOK : { BOOL checked = FALSE; SetGameCheck(Button_GetCheck(GetDlgItem(hDlg, IDC_START_GAME_CHECK))); SetJoyGUI(Button_GetCheck(GetDlgItem(hDlg, IDC_JOY_GUI))); SetKeyGUI(Button_GetCheck(GetDlgItem(hDlg, IDC_KEY_GUI))); SetBroadcast(Button_GetCheck(GetDlgItem(hDlg, IDC_BROADCAST))); SetRandomBackground(Button_GetCheck(GetDlgItem(hDlg, IDC_RANDOM_BG))); SetHideMouseOnStartup(Button_GetCheck(GetDlgItem(hDlg,IDC_HIDE_MOUSE))); if( Button_GetCheck(GetDlgItem(hDlg,IDC_RESET_PLAYCOUNT ) ) ) { ResetPlayCount( -1 ); bRedrawList = TRUE; } if( Button_GetCheck(GetDlgItem(hDlg,IDC_RESET_PLAYTIME ) ) ) { ResetPlayTime( -1 ); bRedrawList = TRUE; } value = SendDlgItemMessage(hDlg,IDC_CYCLETIMESEC, TBM_GETPOS, 0, 0); if( GetCycleScreenshot() != value ) { SetCycleScreenshot(value); } value = SendDlgItemMessage(hDlg,IDC_SCREENSHOT_BORDERSIZE, TBM_GETPOS, 0, 0); if( GetScreenshotBorderSize() != value ) { SetScreenshotBorderSize(value); UpdateScreenShot(); } value = SendDlgItemMessage(hDlg,IDC_HIGH_PRIORITY, TBM_GETPOS, 0, 0); checked = Button_GetCheck(GetDlgItem(hDlg,IDC_STRETCH_SCREENSHOT_LARGER)); if (checked != GetStretchScreenShotLarger()) { SetStretchScreenShotLarger(checked); UpdateScreenShot(); } checked = Button_GetCheck(GetDlgItem(hDlg,IDC_FILTER_INHERIT)); if (checked != GetFilterInherit()) { SetFilterInherit(checked); // LineUpIcons does just a ResetListView(), which is what we want here PostMessage(GetMainWindow(),WM_COMMAND, MAKEWPARAM(ID_VIEW_LINEUPICONS, FALSE),(LPARAM)NULL); } checked = Button_GetCheck(GetDlgItem(hDlg,IDC_NOOFFSET_CLONES)); if (checked != GetOffsetClones()) { SetOffsetClones(checked); // LineUpIcons does just a ResetListView(), which is what we want here PostMessage(GetMainWindow(),WM_COMMAND, MAKEWPARAM(ID_VIEW_LINEUPICONS, FALSE),(LPARAM)NULL); } nCurSelection = ComboBox_GetCurSel(GetDlgItem(hDlg,IDC_SNAPNAME)); if (nCurSelection != CB_ERR) { const char* snapname_selection = (const char*)ComboBox_GetItemData(GetDlgItem(hDlg,IDC_SNAPNAME), nCurSelection); if (snapname_selection) { SetSnapName(snapname_selection); } } EndDialog(hDlg, 0); nCurSelection = ComboBox_GetCurSel(GetDlgItem(hDlg,IDC_HISTORY_TAB)); if (nCurSelection != CB_ERR) nHistoryTab = ComboBox_GetItemData(GetDlgItem(hDlg,IDC_HISTORY_TAB), nCurSelection); EndDialog(hDlg, 0); if( GetHistoryTab() != nHistoryTab ) { SetHistoryTab(nHistoryTab, TRUE); ResizePickerControls(GetMainWindow()); UpdateScreenShot(); } if( bRedrawList ) { UpdateListView(); } return TRUE; } case IDCANCEL : EndDialog(hDlg, 0); return TRUE; } break; } return 0; }
BOOL CALLBACK ProcessListDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static const wchar_t ColumeTitle[][16] = { L"父进程ID", L"EPROCESS", L"程序路径", L"进程ID", L"进程映像名", }; static HWND hList; static HMENU hMenu; static PENUMPROCINFO ProcList = 0; static int SelectedItem; int cx; switch (msg) { case WM_INITDIALOG: { RECT rect; GetClientRect(hDlg, &rect); rect.left += 3; rect.right -= 3; rect.top += 3; rect.bottom -= 50; hList = CreateWindowEx(0, WC_LISTVIEW, NULL, LVS_REPORT | LVS_EDITLABELS | WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_SHOWSELALWAYS, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, hDlg, (HMENU)ID_LISTVIEW5, (HINSTANCE)GetWindowLong(hDlg, GWL_HINSTANCE), NULL); ListView_SetExtendedListViewStyleEx(hList, 0, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT); LVCOLUMN lvc; lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.fmt = LVCFMT_LEFT; lvc.cchTextMax = MAXPATH; lvc.cx = 1; for (int i=0; i<5; ++i) { lvc.iSubItem = i; lvc.pszText = (wchar_t*)ColumeTitle[i]; if (ListView_InsertColumn(hList, 0, &lvc) == -1) LOG(L"规则列表初始化失败F", L"Init"); } cx = rect.right-rect.left; ListView_SetColumnWidth(hList, 0, cx>>3); ListView_SetColumnWidth(hList, 1, cx>>3); ListView_SetColumnWidth(hList, 2, cx>>1); ListView_SetColumnWidth(hList, 3, cx>>3); ListView_SetColumnWidth(hList, 4, cx>>3); PostMessage(hDlg, WM_COMMAND, IDC_ENUM_REFRESH, 0); return TRUE; } //----------------------------------------------------------------------------- case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_ENUM_REFRESH: { int num = 0; if (ProcList) VirtualFree(ProcList, 0, MEM_RELEASE); if (DriCtl.GetProcList(&ProcList, &num)) UpdateListView(hDlg, hList, ProcList, num); else MessageBox(hDlg, L"进程列表获取失败", 0, MB_ICONERROR); return TRUE; } case IDC_ENUM_THREAD_INFO: case IDC_ENUM_MODULE_INFO: { wchar_t buf[16]; ListView_GetItemText(hList, SelectedItem, 1, buf, 16); if (IDC_ENUM_THREAD_INFO == LOWORD(wParam)) DialogBoxParam((HINSTANCE)GetWindowLong(hDlg, GWL_HINSTANCE), MAKEINTRESOURCE(IDD_THREADLIST), hDlg, ThreadListDlgProc, (LPARAM)_wtoi(buf)); else DialogBoxParam((HINSTANCE)GetWindowLong(hDlg, GWL_HINSTANCE), MAKEINTRESOURCE(IDD_MODULELIST), hDlg, ModuleListDlgProc, (LPARAM)_wtoi(buf)); return TRUE; } case IDC_ENUM_TERMINATE: { wchar_t buf[16]; ListView_GetItemText(hList, SelectedItem, 1, buf, 16); DriCtl.TerminateProcess(_wtoi(buf)); return TRUE; } } break; //----------------------------------------------------------------------------- case WM_NOTIFY: if (NM_RCLICK == ((LPNMHDR)lParam)->code) { POINT pt; RECT rect; GetCursorPos(&pt); ScreenToClient(hDlg, &pt); GetClientRect(hDlg, &rect); if (pt.x > rect.left+3 && pt.x < rect.right-3 && pt.y > rect.top+7 && pt.y < rect.bottom-3) { ClientToScreen(hDlg, &pt); TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hDlg, NULL); } return TRUE; } else if (NM_CLICK == ((LPNMHDR)lParam)->code) { LPNMITEMACTIVATE nmitem = (LPNMITEMACTIVATE)lParam; SelectedItem = nmitem->iItem; return TRUE; } break; //----------------------------------------------------------------------------- case WM_CLOSE: EndDialog(hDlg, 0); return TRUE; } return FALSE; }
INT_PTR CALLBACK InterfaceDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { switch (Msg) { case WM_INITDIALOG: { char buffer[200]; int value = 0; CenterWindow(hDlg); hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAMEUI_ICON)); SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); hBrush = CreateSolidBrush(RGB(240, 240, 240)); DisableVisualStylesInterface(hDlg); Button_SetCheck(GetDlgItem(hDlg, IDC_JOY_GUI), GetJoyGUI()); Button_SetCheck(GetDlgItem(hDlg, IDC_DISABLE_TRAY_ICON), GetMinimizeTrayIcon()); Button_SetCheck(GetDlgItem(hDlg, IDC_DISPLAY_NO_ROMS), GetDisplayNoRomsGames()); Button_SetCheck(GetDlgItem(hDlg, IDC_EXIT_DIALOG), GetExitDialog()); Button_SetCheck(GetDlgItem(hDlg, IDC_USE_BROKEN_ICON), GetUseBrokenIcon()); Button_SetCheck(GetDlgItem(hDlg, IDC_STRETCH_SCREENSHOT_LARGER), GetStretchScreenShotLarger()); Button_SetCheck(GetDlgItem(hDlg, IDC_FILTER_INHERIT), GetFilterInherit()); Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_FASTAUDIT), GetEnableFastAudit()); Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_SEVENZIP), GetEnableSevenZip()); Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_DATAFILES), GetEnableDatafiles()); Button_SetCheck(GetDlgItem(hDlg, IDC_SKIP_BIOS), GetSkipBiosMenu()); // Get the current value of the control SendMessage(GetDlgItem(hDlg, IDC_CYCLETIMESEC), TBM_SETRANGE, true, MAKELPARAM(0, 60)); /* [0, 60] */ SendMessage(GetDlgItem(hDlg, IDC_CYCLETIMESEC), TBM_SETTICFREQ, 5, 0); value = GetCycleScreenshot(); SendMessage(GetDlgItem(hDlg, IDC_CYCLETIMESEC), TBM_SETPOS, true, value); snprintf(buffer, WINUI_ARRAY_LENGTH(buffer), "%d", value); win_set_window_text_utf8(GetDlgItem(hDlg, IDC_CYCLETIMESECTXT), buffer); for (int i = 0; i < NUMHISTORYTAB; i++) { (void)ComboBox_InsertString(GetDlgItem(hDlg, IDC_HISTORY_TAB), i, g_ComboBoxHistoryTab[i].m_pText); (void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), i, g_ComboBoxHistoryTab[i].m_pData); } if (GetHistoryTab() < MAX_TAB_TYPES) (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_HISTORY_TAB), GetHistoryTab()); else (void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_HISTORY_TAB), GetHistoryTab() - TAB_SUBTRACT); SendMessage(GetDlgItem(hDlg, IDC_SCREENSHOT_BORDERSIZE), TBM_SETRANGE, true, MAKELPARAM(0, 50)); /* [0, 50] */ SendMessage(GetDlgItem(hDlg, IDC_SCREENSHOT_BORDERSIZE), TBM_SETTICFREQ, 5, 0); value = GetScreenshotBorderSize(); SendMessage(GetDlgItem(hDlg, IDC_SCREENSHOT_BORDERSIZE), TBM_SETPOS, true, value); snprintf(buffer, WINUI_ARRAY_LENGTH(buffer), "%d", value); win_set_window_text_utf8(GetDlgItem(hDlg, IDC_SCREENSHOT_BORDERSIZETXT), buffer); EnableWindow(GetDlgItem(hDlg, IDC_ENABLE_SEVENZIP), GetEnableFastAudit() ? true : false); break; } case WM_CTLCOLORDLG: return (LRESULT) hBrush; case WM_CTLCOLORSTATIC: case WM_CTLCOLORBTN: hDC = (HDC)wParam; SetBkMode(hDC, TRANSPARENT); SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT)); return (LRESULT) hBrush; case WM_HSCROLL: HANDLE_WM_HSCROLL(hDlg, wParam, lParam, OnHScroll); break; case WM_COMMAND: switch (GET_WM_COMMAND_ID(wParam, lParam)) { case IDC_SCREENSHOT_BORDERCOLOR: { CHOOSECOLOR cc; COLORREF choice_colors[16]; for (int i = 0; i < 16; i++) choice_colors[i] = GetCustomColor(i); cc.lStructSize = sizeof(CHOOSECOLOR); cc.hwndOwner = hDlg; cc.lpfnHook = &CCHookProc; cc.rgbResult = GetScreenshotBorderColor(); cc.lpCustColors = choice_colors; cc.Flags = CC_ANYCOLOR | CC_RGBINIT | CC_FULLOPEN | CC_ENABLEHOOK; if (!ChooseColor(&cc)) return true; for (int i = 0; i < 16; i++) SetCustomColor(i,choice_colors[i]); SetScreenshotBorderColor(cc.rgbResult); UpdateScreenShot(); return true; } case IDC_ENABLE_FASTAUDIT: { bool enabled = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_FASTAUDIT)); EnableWindow(GetDlgItem(hDlg, IDC_ENABLE_SEVENZIP), enabled ? true : false); return true; } case IDOK: { bool bRedrawList = false; bool checked = false; int value = 0; SetJoyGUI(Button_GetCheck(GetDlgItem(hDlg, IDC_JOY_GUI))); SetMinimizeTrayIcon(Button_GetCheck(GetDlgItem(hDlg, IDC_DISABLE_TRAY_ICON))); SetExitDialog(Button_GetCheck(GetDlgItem(hDlg, IDC_EXIT_DIALOG))); SetEnableFastAudit(Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_FASTAUDIT))); SetEnableSevenZip(Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_SEVENZIP))); SetEnableDatafiles(Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_DATAFILES))); SetSkipBiosMenu(Button_GetCheck(GetDlgItem(hDlg, IDC_SKIP_BIOS))); if (Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_PLAYCOUNT))) { for (int i = 0; i < driver_list::total(); i++) ResetPlayCount(i); bRedrawList = true; } if (Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_PLAYTIME))) { for (int i = 0; i < driver_list::total(); i++) ResetPlayTime(i); bRedrawList = true; } value = SendDlgItemMessage(hDlg, IDC_CYCLETIMESEC, TBM_GETPOS, 0, 0); if (GetCycleScreenshot() != value) SetCycleScreenshot(value); value = SendDlgItemMessage(hDlg, IDC_SCREENSHOT_BORDERSIZE, TBM_GETPOS, 0, 0); if (GetScreenshotBorderSize() != value) { SetScreenshotBorderSize(value); UpdateScreenShot(); } checked = Button_GetCheck(GetDlgItem(hDlg, IDC_STRETCH_SCREENSHOT_LARGER)); if (checked != GetStretchScreenShotLarger()) { SetStretchScreenShotLarger(checked); UpdateScreenShot(); } checked = Button_GetCheck(GetDlgItem(hDlg, IDC_FILTER_INHERIT)); if (checked != GetFilterInherit()) { SetFilterInherit(checked); bRedrawList = true; } checked = Button_GetCheck(GetDlgItem(hDlg, IDC_USE_BROKEN_ICON)); if (checked != GetUseBrokenIcon()) { SetUseBrokenIcon(checked); bRedrawList = true; } checked = Button_GetCheck(GetDlgItem(hDlg, IDC_DISPLAY_NO_ROMS)); if (checked != GetDisplayNoRomsGames()) { SetDisplayNoRomsGames(checked); bRedrawList = true; } int nCurSelection = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_HISTORY_TAB)); int nHistoryTab = 0; if (nCurSelection != CB_ERR) nHistoryTab = ComboBox_GetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nCurSelection); DestroyIcon(hIcon); DeleteObject(hBrush); EndDialog(hDlg, 0); if(GetHistoryTab() != nHistoryTab) { SetHistoryTab(nHistoryTab, true); ResizePickerControls(GetMainWindow()); UpdateScreenShot(); } if(bRedrawList) UpdateListView(); SaveInternalUI(); return true; } case IDCANCEL: DestroyIcon(hIcon); DeleteObject(hBrush); EndDialog(hDlg, 0); return true; } break; } return false; }