HWND CreateProgressDialog(HWND hParent, UINT LabelId) { HWND hProgDlg; LPWSTR lpProgStr; /* open the progress dialog */ hProgDlg = CreateDialogW(hInstance, MAKEINTRESOURCEW(IDD_DLG_PROGRESS), hParent, ProgressDialogProc); if (hProgDlg != NULL) { /* Load the label Id */ if (AllocAndLoadString(&lpProgStr, hInstance, LabelId)) { /* Write it to the dialog */ SendDlgItemMessageW(hProgDlg, IDC_SERVCON_INFO, WM_SETTEXT, 0, (LPARAM)lpProgStr); HeapFree(GetProcessHeap(), 0, lpProgStr); } } return hProgDlg; }
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { g_Instance = hInstance; HWND hDlg = CreateDialogW(hInstance, MAKEINTRESOURCE (IDD_TUNDRA), 0, DialogProc); if (hDlg==NULL) { std::wostringstream errstrm; errstrm << "Error: " << GetLastError (); MessageBoxW (0, errstrm.str().c_str(), L"Error", MB_ICONEXCLAMATION | MB_OK); return 1; } ::ShowWindow(hDlg, SW_SHOW); MSG msg; int status; while ((status = GetMessage(&msg, 0, 0, 0))!=0) { TranslateMessage (&msg); DispatchMessage (&msg); } return 0; }
void SearchDialog(void) { static DLGPROC DlgProc; if (!DlgProc) DlgProc = (DLGPROC)MakeProcInstance((FARPROC)SearchCallback, hInst); if (hwndSearch) BringWindowToTop(hwndSearch); else hwndSearch = CreateDialogW(hInst, MAKEINTRESW(IDD_SEARCH), hwndMain, DlgProc); }
HWND TransferringDialogBox(HWND dialog, LONG progress) { if (!dialog) dialog = CreateDialogW(GPHOTO2_instance, (LPWSTR)MAKEINTRESOURCE(IDD_DIALOG1), NULL, ProgressProc); if (progress == -1) { EndDialog(dialog,0); return NULL; } RedrawWindow(dialog,NULL,NULL, RDW_INTERNALPAINT|RDW_UPDATENOW|RDW_ALLCHILDREN); return dialog; }
static void PopulateImageList(HIMAGELIST *iList, HWND list) { struct gphoto2_file *file; HWND progress_dialog; progress_dialog = CreateDialogW(GPHOTO2_instance,(LPWSTR)MAKEINTRESOURCE(IDD_CONNECTING), NULL, ConnectingProc); LIST_FOR_EACH_ENTRY( file, &activeDS.files, struct gphoto2_file, entry) { if (strstr(file->filename,".JPG") || strstr(file->filename,".jpg")) { HBITMAP bitmap; BITMAP bmpInfo; #ifdef HAVE_GPHOTO2 _get_gphoto2_file_as_DIB(file->folder, file->filename, GP_FILE_TYPE_PREVIEW, 0, &bitmap); #else bitmap = 0; #endif GetObjectA(bitmap,sizeof(BITMAP),&bmpInfo); if (*iList == 0) { *iList = ImageList_Create(bmpInfo.bmWidth, bmpInfo.bmHeight,ILC_COLOR24, 10,10); SendMessageW(list, LVM_SETICONSPACING, 0, MAKELONG(bmpInfo.bmWidth+6, bmpInfo.bmHeight+15) ); } ImageList_Add(*iList, bitmap, 0); DeleteObject(static_bitmap); static_bitmap = bitmap; SendMessageW(GetDlgItem(progress_dialog,IDC_BITMAP),STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)static_bitmap); RedrawWindow(progress_dialog,NULL,NULL,RDW_INTERNALPAINT|RDW_UPDATENOW|RDW_ALLCHILDREN); } } EndDialog(progress_dialog,0); }
static BOOL OnCreate(HWND hWnd) { HMENU hMenu; HMENU hEditMenu; HMENU hViewMenu; HMENU hUpdateSpeedMenu; HMENU hCPUHistoryMenu; int nActivePage; int nParts[3]; RECT rc; TCITEMW item; static WCHAR wszApplications[255]; static WCHAR wszProcesses[255]; static WCHAR wszPerformance[255]; LoadStringW(hInst, IDS_APPLICATIONS, wszApplications, sizeof(wszApplications)/sizeof(WCHAR)); LoadStringW(hInst, IDS_PROCESSES, wszProcesses, sizeof(wszProcesses)/sizeof(WCHAR)); LoadStringW(hInst, IDS_PERFORMANCE, wszPerformance, sizeof(wszPerformance)/sizeof(WCHAR)); SendMessageW(hMainWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconW(hInst, MAKEINTRESOURCEW(IDI_TASKMANAGER))); SendMessageW(hMainWnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadImageW(hInst, MAKEINTRESOURCEW(IDI_TASKMANAGER), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)); /* Initialize the Windows Common Controls DLL */ InitCommonControls(); /* Get the minimum window sizes */ GetWindowRect(hWnd, &rc); nMinimumWidth = (rc.right - rc.left); nMinimumHeight = (rc.bottom - rc.top); /* Create the status bar */ hStatusWnd = CreateStatusWindowW(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, NULL, hWnd, STATUS_WINDOW); if(!hStatusWnd) return FALSE; /* Create the status bar panes */ nParts[0] = 100; nParts[1] = 210; nParts[2] = 400; SendMessageW(hStatusWnd, SB_SETPARTS, 3, (LPARAM)nParts); /* Create tab pages */ hTabWnd = GetDlgItem(hWnd, IDC_TAB); #if 1 hApplicationPage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_APPLICATION_PAGE), hWnd, ApplicationPageWndProc); hProcessPage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_PROCESS_PAGE), hWnd, ProcessPageWndProc); hPerformancePage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_PERFORMANCE_PAGE), hWnd, PerformancePageWndProc); #else hApplicationPage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_APPLICATION_PAGE), hTabWnd, ApplicationPageWndProc); hProcessPage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_PROCESS_PAGE), hTabWnd, ProcessPageWndProc); hPerformancePage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_PERFORMANCE_PAGE), hTabWnd, PerformancePageWndProc); #endif /* Insert tabs */ memset(&item, 0, sizeof(TCITEMW)); item.mask = TCIF_TEXT; item.pszText = wszApplications; SendMessageW(hTabWnd, TCM_INSERTITEMW, 0, (LPARAM)&item); memset(&item, 0, sizeof(TCITEMW)); item.mask = TCIF_TEXT; item.pszText = wszProcesses; SendMessageW(hTabWnd, TCM_INSERTITEMW, 1, (LPARAM)&item); memset(&item, 0, sizeof(TCITEMW)); item.mask = TCIF_TEXT; item.pszText = wszPerformance; SendMessageW(hTabWnd, TCM_INSERTITEMW, 2, (LPARAM)&item); /* Size everything correctly */ GetClientRect(hWnd, &rc); nOldWidth = rc.right; nOldHeight = rc.bottom; /* nOldStartX = rc.left; */ /*nOldStartY = rc.top; */ #define PAGE_OFFSET_LEFT 17 #define PAGE_OFFSET_TOP 72 #define PAGE_OFFSET_WIDTH (PAGE_OFFSET_LEFT*2) #define PAGE_OFFSET_HEIGHT (PAGE_OFFSET_TOP+32) if ((TaskManagerSettings.Left != 0) || (TaskManagerSettings.Top != 0) || (TaskManagerSettings.Right != 0) || (TaskManagerSettings.Bottom != 0)) { MoveWindow(hWnd, TaskManagerSettings.Left, TaskManagerSettings.Top, TaskManagerSettings.Right - TaskManagerSettings.Left, TaskManagerSettings.Bottom - TaskManagerSettings.Top, TRUE); #ifdef __GNUC__TEST__ MoveWindow(hApplicationPage, TaskManagerSettings.Left + PAGE_OFFSET_LEFT, TaskManagerSettings.Top + PAGE_OFFSET_TOP, TaskManagerSettings.Right - TaskManagerSettings.Left - PAGE_OFFSET_WIDTH, TaskManagerSettings.Bottom - TaskManagerSettings.Top - PAGE_OFFSET_HEIGHT, FALSE); MoveWindow(hProcessPage, TaskManagerSettings.Left + PAGE_OFFSET_LEFT, TaskManagerSettings.Top + PAGE_OFFSET_TOP, TaskManagerSettings.Right - TaskManagerSettings.Left - PAGE_OFFSET_WIDTH, TaskManagerSettings.Bottom - TaskManagerSettings.Top - PAGE_OFFSET_HEIGHT, FALSE); MoveWindow(hPerformancePage, TaskManagerSettings.Left + PAGE_OFFSET_LEFT, TaskManagerSettings.Top + PAGE_OFFSET_TOP, TaskManagerSettings.Right - TaskManagerSettings.Left - PAGE_OFFSET_WIDTH, TaskManagerSettings.Bottom - TaskManagerSettings.Top - PAGE_OFFSET_HEIGHT, FALSE); #endif } if (TaskManagerSettings.Maximized) ShowWindow(hWnd, SW_MAXIMIZE); /* Set the always on top style */ hMenu = GetMenu(hWnd); hEditMenu = GetSubMenu(hMenu, 1); hViewMenu = GetSubMenu(hMenu, 2); hUpdateSpeedMenu = GetSubMenu(hViewMenu, 1); hCPUHistoryMenu = GetSubMenu(hViewMenu, 7); /* Check or uncheck the always on top menu item */ if (TaskManagerSettings.AlwaysOnTop) { CheckMenuItem(hEditMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND|MF_CHECKED); SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); } else { CheckMenuItem(hEditMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND|MF_UNCHECKED); SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); } /* Check or uncheck the minimize on use menu item */ if (TaskManagerSettings.MinimizeOnUse) CheckMenuItem(hEditMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_CHECKED); else CheckMenuItem(hEditMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_UNCHECKED); /* Check or uncheck the hide when minimized menu item */ if (TaskManagerSettings.HideWhenMinimized) CheckMenuItem(hEditMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_CHECKED); else CheckMenuItem(hEditMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_UNCHECKED); /* Check or uncheck the show 16-bit tasks menu item */ if (TaskManagerSettings.Show16BitTasks) CheckMenuItem(hEditMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_CHECKED); else CheckMenuItem(hEditMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_UNCHECKED); if (TaskManagerSettings.View_LargeIcons) CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_LARGE, MF_BYCOMMAND); else if (TaskManagerSettings.View_SmallIcons) CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_SMALL, MF_BYCOMMAND); else CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_DETAILS, MF_BYCOMMAND); if (TaskManagerSettings.ShowKernelTimes) CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_CHECKED); else CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_UNCHECKED); if (TaskManagerSettings.UpdateSpeed == 1) CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH, ID_VIEW_UPDATESPEED_PAUSED, ID_VIEW_UPDATESPEED_HIGH, MF_BYCOMMAND); else if (TaskManagerSettings.UpdateSpeed == 2) CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH, ID_VIEW_UPDATESPEED_PAUSED, ID_VIEW_UPDATESPEED_NORMAL, MF_BYCOMMAND); else if (TaskManagerSettings.UpdateSpeed == 4) CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH, ID_VIEW_UPDATESPEED_PAUSED, ID_VIEW_UPDATESPEED_LOW, MF_BYCOMMAND); else CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH, ID_VIEW_UPDATESPEED_PAUSED, ID_VIEW_UPDATESPEED_PAUSED, MF_BYCOMMAND); if (TaskManagerSettings.CPUHistory_OneGraphPerCPU) CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND); else CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHALL, MF_BYCOMMAND); nActivePage = TaskManagerSettings.ActiveTabPage; SendMessageW(hTabWnd, TCM_SETCURFOCUS, 0, 0); SendMessageW(hTabWnd, TCM_SETCURFOCUS, 1, 0); SendMessageW(hTabWnd, TCM_SETCURFOCUS, 2, 0); SendMessageW(hTabWnd, TCM_SETCURFOCUS, nActivePage, 0); if (TaskManagerSettings.UpdateSpeed == 1) SetTimer(hWnd, 1, 1000, NULL); else if (TaskManagerSettings.UpdateSpeed == 2) SetTimer(hWnd, 1, 2000, NULL); else if (TaskManagerSettings.UpdateSpeed == 4) SetTimer(hWnd, 1, 4000, NULL); /* * Refresh the performance data * Sample it twice so we can establish * the delta values & cpu usage */ PerfDataRefresh(); PerfDataRefresh(); RefreshApplicationPage(); RefreshProcessPage(); RefreshPerformancePage(); TrayIcon_ShellAddTrayIcon(); return TRUE; }
//============================================================================== BOOL CALLBACK GbaSlotBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) { switch(msg) { case WM_INITDIALOG: { OKbutton = GetDlgItem(dialog, IDOK); for(int i = 0; i < NDS_ADDON_COUNT; i++) ComboBox_AddString(GetDlgItem(dialog, IDC_ADDONS_LIST), addonList[i].name); ComboBox_SetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST), temp_type); u8 tmp_info[512]; addonList[temp_type].info((char *)tmp_info); SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), (char *)tmp_info); _OKbutton = false; wndConfig=CreateDialogW(hAppInst, MAKEINTRESOURCEW(GBAslot_IDDs[temp_type]), dialog, (DLGPROC)GBAslot_Procs[temp_type]); if ( (temp_type == 0) || (_OKbutton) ) EnableWindow(OKbutton, TRUE); else EnableWindow(OKbutton, FALSE); return TRUE; } case WM_COMMAND: { switch (LOWORD(wparam)) { case IDOK: { int Msg = IDYES; if (romloaded && (needReset || (temp_type!=addon_type)) ) { Msg = MessageBox(dialog, "After change GBA slot pak game will reset!\nAre you sure to continue?", "DeSmuME", MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2); } if (Msg == IDYES) { if (wndConfig) DestroyWindow(wndConfig); EndDialog(dialog, TRUE); } } return TRUE; case IDCANCEL: if (wndConfig) DestroyWindow(wndConfig); EndDialog(dialog, FALSE); return TRUE; case IDC_ADDONS_LIST: if (HIWORD(wparam) == CBN_SELENDOK) { temp_type = ComboBox_GetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST)); if (temp_type != last_type) { if (wndConfig) DestroyWindow(wndConfig); _OKbutton = false; wndConfig=CreateDialogW(hAppInst, MAKEINTRESOURCEW(GBAslot_IDDs[temp_type]), dialog, (DLGPROC)GBAslot_Procs[temp_type]); if ( (temp_type == 0) || (_OKbutton) ) EnableWindow(OKbutton, TRUE); else EnableWindow(OKbutton, FALSE); u8 tmp_info[512]; addonList[temp_type].info((char *)tmp_info); SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), (char *)tmp_info); last_type = temp_type; } } return TRUE; } break; } } return FALSE; }
BOOL OnCreate(HWND hWnd) { HMENU hMenu; HMENU hEditMenu; HMENU hViewMenu; HMENU hShutMenu; HMENU hUpdateSpeedMenu; HMENU hCPUHistoryMenu; int nActivePage; int nParts[3]; RECT rc; WCHAR szTemp[256]; WCHAR szLogOffItem[MAX_PATH]; LPWSTR lpUserName; TCITEM item; DWORD len = 0; SendMessageW(hMainWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconW(hInst, MAKEINTRESOURCEW(IDI_TASKMANAGER))); /* Initialize the Windows Common Controls DLL */ InitCommonControls(); /* Get the minimum window sizes */ GetWindowRect(hWnd, &rc); nMinimumWidth = (rc.right - rc.left); nMinimumHeight = (rc.bottom - rc.top); /* Create the status bar */ hStatusWnd = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, L"", hWnd, STATUS_WINDOW); if(!hStatusWnd) return FALSE; /* Create the status bar panes */ nParts[0] = STATUS_SIZE1; nParts[1] = STATUS_SIZE2; nParts[2] = STATUS_SIZE3; SendMessageW(hStatusWnd, SB_SETPARTS, 3, (LPARAM) (LPINT) nParts); /* Create tab pages */ hTabWnd = GetDlgItem(hWnd, IDC_TAB); #if 1 hApplicationPage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_APPLICATION_PAGE), hWnd, ApplicationPageWndProc); EnableDialogTheme(hApplicationPage); hProcessPage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_PROCESS_PAGE), hWnd, ProcessPageWndProc); EnableDialogTheme(hProcessPage); hPerformancePage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_PERFORMANCE_PAGE), hWnd, PerformancePageWndProc); EnableDialogTheme(hPerformancePage); #else hApplicationPage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_APPLICATION_PAGE), hTabWnd, ApplicationPageWndProc); EnableDialogTheme(hApplicationPage); hProcessPage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_PROCESS_PAGE), hTabWnd, ProcessPageWndProc); EnableDialogTheme(hProcessPage); hPerformancePage = CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_PERFORMANCE_PAGE), hTabWnd, PerformancePageWndProc); EnableDialogTheme(hPerformancePage); #endif /* Insert tabs */ LoadStringW(hInst, IDS_TAB_APPS, szTemp, 256); memset(&item, 0, sizeof(TCITEM)); item.mask = TCIF_TEXT; item.pszText = szTemp; (void)TabCtrl_InsertItem(hTabWnd, 0, &item); LoadStringW(hInst, IDS_TAB_PROCESSES, szTemp, 256); memset(&item, 0, sizeof(TCITEM)); item.mask = TCIF_TEXT; item.pszText = szTemp; (void)TabCtrl_InsertItem(hTabWnd, 1, &item); LoadStringW(hInst, IDS_TAB_PERFORMANCE, szTemp, 256); memset(&item, 0, sizeof(TCITEM)); item.mask = TCIF_TEXT; item.pszText = szTemp; (void)TabCtrl_InsertItem(hTabWnd, 2, &item); /* Size everything correctly */ GetClientRect(hWnd, &rc); nOldWidth = rc.right; nOldHeight = rc.bottom; /* nOldStartX = rc.left; */ /*nOldStartY = rc.top; */ #define PAGE_OFFSET_LEFT 17 #define PAGE_OFFSET_TOP 72 #define PAGE_OFFSET_WIDTH (PAGE_OFFSET_LEFT*2) #define PAGE_OFFSET_HEIGHT (PAGE_OFFSET_TOP+32) if ((TaskManagerSettings.Left != 0) || (TaskManagerSettings.Top != 0) || (TaskManagerSettings.Right != 0) || (TaskManagerSettings.Bottom != 0)) { MoveWindow(hWnd, TaskManagerSettings.Left, TaskManagerSettings.Top, TaskManagerSettings.Right - TaskManagerSettings.Left, TaskManagerSettings.Bottom - TaskManagerSettings.Top, TRUE); #ifdef __GNUC__TEST__ MoveWindow(hApplicationPage, TaskManagerSettings.Left + PAGE_OFFSET_LEFT, TaskManagerSettings.Top + PAGE_OFFSET_TOP, TaskManagerSettings.Right - TaskManagerSettings.Left - PAGE_OFFSET_WIDTH, TaskManagerSettings.Bottom - TaskManagerSettings.Top - PAGE_OFFSET_HEIGHT, FALSE); MoveWindow(hProcessPage, TaskManagerSettings.Left + PAGE_OFFSET_LEFT, TaskManagerSettings.Top + PAGE_OFFSET_TOP, TaskManagerSettings.Right - TaskManagerSettings.Left - PAGE_OFFSET_WIDTH, TaskManagerSettings.Bottom - TaskManagerSettings.Top - PAGE_OFFSET_HEIGHT, FALSE); MoveWindow(hPerformancePage, TaskManagerSettings.Left + PAGE_OFFSET_LEFT, TaskManagerSettings.Top + PAGE_OFFSET_TOP, TaskManagerSettings.Right - TaskManagerSettings.Left - PAGE_OFFSET_WIDTH, TaskManagerSettings.Bottom - TaskManagerSettings.Top - PAGE_OFFSET_HEIGHT, FALSE); #endif } if (TaskManagerSettings.Maximized) ShowWindow(hWnd, SW_MAXIMIZE); /* Set the always on top style */ hMenu = GetMenu(hWnd); hEditMenu = GetSubMenu(hMenu, 1); hViewMenu = GetSubMenu(hMenu, 2); hShutMenu = GetSubMenu(hMenu, 4); hUpdateSpeedMenu = GetSubMenu(hViewMenu, 1); hCPUHistoryMenu = GetSubMenu(hViewMenu, 7); /* Check or uncheck the always on top menu item */ if (TaskManagerSettings.AlwaysOnTop) { CheckMenuItem(hEditMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND|MF_CHECKED); SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); } else { CheckMenuItem(hEditMenu, ID_OPTIONS_ALWAYSONTOP, MF_BYCOMMAND|MF_UNCHECKED); SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); } /* Check or uncheck the minimize on use menu item */ if (TaskManagerSettings.MinimizeOnUse) CheckMenuItem(hEditMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_CHECKED); else CheckMenuItem(hEditMenu, ID_OPTIONS_MINIMIZEONUSE, MF_BYCOMMAND|MF_UNCHECKED); /* Check or uncheck the hide when minimized menu item */ if (TaskManagerSettings.HideWhenMinimized) CheckMenuItem(hEditMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_CHECKED); else CheckMenuItem(hEditMenu, ID_OPTIONS_HIDEWHENMINIMIZED, MF_BYCOMMAND|MF_UNCHECKED); /* Check or uncheck the show 16-bit tasks menu item */ if (TaskManagerSettings.Show16BitTasks) CheckMenuItem(hEditMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_CHECKED); else CheckMenuItem(hEditMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_UNCHECKED); /* Set the view mode */ CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, TaskManagerSettings.ViewMode, MF_BYCOMMAND); if (TaskManagerSettings.ShowKernelTimes) CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_CHECKED); else CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_UNCHECKED); CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH, ID_VIEW_UPDATESPEED_PAUSED, TaskManagerSettings.UpdateSpeed, MF_BYCOMMAND); if (TaskManagerSettings.CPUHistory_OneGraphPerCPU) CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND); else CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHALL, MF_BYCOMMAND); nActivePage = TaskManagerSettings.ActiveTabPage; TabCtrl_SetCurFocus/*Sel*/(hTabWnd, 0); TabCtrl_SetCurFocus/*Sel*/(hTabWnd, 1); TabCtrl_SetCurFocus/*Sel*/(hTabWnd, 2); TabCtrl_SetCurFocus/*Sel*/(hTabWnd, nActivePage); /* Set the username in the "Log Off %s" item of the Shutdown menu */ /* 1- Get the menu item text and store it temporarily */ GetMenuStringW(hShutMenu, ID_SHUTDOWN_LOGOFF, szTemp, 256, MF_BYCOMMAND); /* 2- Retrieve the username length first, then allocate a buffer for it and call it again */ if (!GetUserNameW(NULL, &len) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { lpUserName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof(WCHAR)); if (lpUserName && GetUserNameW(lpUserName, &len)) { _snwprintf(szLogOffItem, sizeof(szLogOffItem)/sizeof(szLogOffItem[0]), szTemp, lpUserName); szLogOffItem[sizeof(szLogOffItem)/sizeof(szLogOffItem[0]) - 1] = UNICODE_NULL; } else { _snwprintf(szLogOffItem, sizeof(szLogOffItem)/sizeof(szLogOffItem[0]), szTemp, L"n/a"); } if (lpUserName) HeapFree(GetProcessHeap(), 0, lpUserName); } else { _snwprintf(szLogOffItem, sizeof(szLogOffItem)/sizeof(szLogOffItem[0]), szTemp, L"n/a"); } /* 3- Set the menu item text to its formatted counterpart */ ModifyMenuW(hShutMenu, ID_SHUTDOWN_LOGOFF, MF_BYCOMMAND | MF_STRING, ID_SHUTDOWN_LOGOFF, szLogOffItem); /* Setup update speed */ SetUpdateSpeed(hWnd); /* * Refresh the performance data * Sample it twice so we can establish * the delta values & cpu usage */ PerfDataRefresh(); PerfDataRefresh(); RefreshApplicationPage(); RefreshProcessPage(); RefreshPerformancePage(); TrayIcon_ShellAddTrayIcon(); return TRUE; }
//============================================================================== BOOL CALLBACK GbaSlotBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) { switch(msg) { case WM_INITDIALOG: { OKbutton = GetDlgItem(dialog, IDOK); for(int i = 0; i < NDS_SLOT2_COUNT; i++) ComboBox_AddString(GetDlgItem(dialog, IDC_ADDONS_LIST), slot2_List[i]->info()->name()); ComboBox_SetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST), temp_type); SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), slot2_List[temp_type]->info()->descr()); _OKbutton = false; wndConfig=CreateDialogW(hAppInst, MAKEINTRESOURCEW(GBAslot_IDDs[temp_type]), dialog, (DLGPROC)GBAslot_Procs[temp_type]); if ( (temp_type == 0) || (_OKbutton) ) EnableWindow(OKbutton, TRUE); else EnableWindow(OKbutton, FALSE); return TRUE; } case WM_COMMAND: { switch (LOWORD(wparam)) { case IDOK: { if (wndConfig) DestroyWindow(wndConfig); EndDialog(dialog, TRUE); } return TRUE; case IDCANCEL: if (wndConfig) DestroyWindow(wndConfig); EndDialog(dialog, FALSE); return TRUE; case IDC_ADDONS_LIST: if (HIWORD(wparam) == CBN_SELENDOK) { temp_type = ComboBox_GetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST)); if (temp_type != last_type) { if (wndConfig) DestroyWindow(wndConfig); _OKbutton = false; wndConfig=CreateDialogW(hAppInst, MAKEINTRESOURCEW(GBAslot_IDDs[temp_type]), dialog, (DLGPROC)GBAslot_Procs[temp_type]); if ( (temp_type == 0) || (_OKbutton) ) EnableWindow(OKbutton, TRUE); else EnableWindow(OKbutton, FALSE); SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), slot2_List[temp_type]->info()->descr()); last_type = temp_type; } } return TRUE; } break; } } return FALSE; }
/************************************************************************* * AboutDlgProc (internal) */ static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { static DWORD cxLogoBmp; static DWORD cyLogoBmp; static HBITMAP hLogoBmp; static HWND hWndAuthors; switch(msg) { case WM_INITDIALOG: { ABOUT_INFO *info = (ABOUT_INFO *)lParam; if (info) { const WCHAR szRegKey[] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"; HKEY hRegKey; MEMORYSTATUSEX MemStat; WCHAR szAppTitle[512]; WCHAR szAppTitleTemplate[512]; WCHAR szAuthorsText[20]; // Preload the ROS bitmap hLogoBmp = (HBITMAP)LoadImage(shell32_hInstance, MAKEINTRESOURCE(IDB_REACTOS), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); if(hLogoBmp) { BITMAP bmpLogo; GetObject( hLogoBmp, sizeof(BITMAP), &bmpLogo ); cxLogoBmp = bmpLogo.bmWidth; cyLogoBmp = bmpLogo.bmHeight; } // Set App-specific stuff (icon, app name, szOtherStuff string) SendDlgItemMessageW(hWnd, IDC_ABOUT_ICON, STM_SETICON, (WPARAM)info->hIcon, 0); GetWindowTextW( hWnd, szAppTitleTemplate, sizeof(szAppTitleTemplate) / sizeof(WCHAR) ); swprintf( szAppTitle, szAppTitleTemplate, info->szApp ); SetWindowTextW( hWnd, szAppTitle ); SetDlgItemTextW( hWnd, IDC_ABOUT_APPNAME, info->szApp ); SetDlgItemTextW( hWnd, IDC_ABOUT_OTHERSTUFF, info->szOtherStuff ); // Set the registered user and organization name if(RegOpenKeyExW( HKEY_LOCAL_MACHINE, szRegKey, 0, KEY_QUERY_VALUE, &hRegKey ) == ERROR_SUCCESS) { SetRegTextData( hWnd, hRegKey, L"RegisteredOwner", IDC_ABOUT_REG_USERNAME ); SetRegTextData( hWnd, hRegKey, L"RegisteredOrganization", IDC_ABOUT_REG_ORGNAME ); RegCloseKey( hRegKey ); } // Set the value for the installed physical memory MemStat.dwLength = sizeof(MemStat); if( GlobalMemoryStatusEx(&MemStat) ) { WCHAR szBuf[12]; if (MemStat.ullTotalPhys > 1024 * 1024 * 1024) { double dTotalPhys; WCHAR szDecimalSeparator[4]; WCHAR szUnits[3]; // We're dealing with GBs or more MemStat.ullTotalPhys /= 1024 * 1024; if (MemStat.ullTotalPhys > 1024 * 1024) { // We're dealing with TBs or more MemStat.ullTotalPhys /= 1024; if (MemStat.ullTotalPhys > 1024 * 1024) { // We're dealing with PBs or more MemStat.ullTotalPhys /= 1024; dTotalPhys = (double)MemStat.ullTotalPhys / 1024; wcscpy( szUnits, L"PB" ); } else { dTotalPhys = (double)MemStat.ullTotalPhys / 1024; wcscpy( szUnits, L"TB" ); } } else { dTotalPhys = (double)MemStat.ullTotalPhys / 1024; wcscpy( szUnits, L"GB" ); } // We need the decimal point of the current locale to display the RAM size correctly if (GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, szDecimalSeparator, sizeof(szDecimalSeparator) / sizeof(WCHAR)) > 0) { UCHAR uDecimals; UINT uIntegral; uIntegral = (UINT)dTotalPhys; uDecimals = (UCHAR)((UINT)(dTotalPhys * 100) - uIntegral * 100); // Display the RAM size with 2 decimals swprintf(szBuf, L"%u%s%02u %s", uIntegral, szDecimalSeparator, uDecimals, szUnits); } } else { // We're dealing with MBs, don't show any decimals swprintf( szBuf, L"%u MB", (UINT)MemStat.ullTotalPhys / 1024 / 1024 ); } SetDlgItemTextW( hWnd, IDC_ABOUT_PHYSMEM, szBuf); } // Add the Authors dialog hWndAuthors = CreateDialogW( shell32_hInstance, MAKEINTRESOURCEW(IDD_ABOUT_AUTHORS), hWnd, AboutAuthorsDlgProc ); LoadStringW( shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, sizeof(szAuthorsText) / sizeof(WCHAR) ); SetDlgItemTextW( hWnd, IDC_ABOUT_AUTHORS, szAuthorsText ); } return TRUE; } case WM_PAINT: { if(hLogoBmp) { PAINTSTRUCT ps; HDC hdc; HDC hdcMem; hdc = BeginPaint(hWnd, &ps); hdcMem = CreateCompatibleDC(hdc); if(hdcMem) { SelectObject(hdcMem, hLogoBmp); BitBlt(hdc, 0, 0, cxLogoBmp, cyLogoBmp, hdcMem, 0, 0, SRCCOPY); DeleteDC(hdcMem); } EndPaint(hWnd, &ps); } }; break; case WM_COMMAND: { switch(wParam) { case IDOK: case IDCANCEL: EndDialog(hWnd, TRUE); return TRUE; case IDC_ABOUT_AUTHORS: { static BOOL bShowingAuthors = FALSE; WCHAR szAuthorsText[20]; if(bShowingAuthors) { LoadStringW( shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, sizeof(szAuthorsText) / sizeof(WCHAR) ); ShowWindow( hWndAuthors, SW_HIDE ); } else { LoadStringW( shell32_hInstance, IDS_SHELL_ABOUT_BACK, szAuthorsText, sizeof(szAuthorsText) / sizeof(WCHAR) ); ShowWindow( hWndAuthors, SW_SHOW ); } SetDlgItemTextW( hWnd, IDC_ABOUT_AUTHORS, szAuthorsText ); bShowingAuthors = !bShowingAuthors; return TRUE; } } }; break; case WM_CLOSE: EndDialog(hWnd, TRUE); break; } return 0; }
//============================================================================== BOOL CALLBACK Slot1Box_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) { switch(msg) { case WM_INITDIALOG: { OKbutton_slot1 = GetDlgItem(dialog, IDOK); for(int i = 0; i < NDS_SLOT1_COUNT; i++) ComboBox_AddString(GetDlgItem(dialog, IDC_ADDONS_LIST), slot1_List[i]->info()->name()); ComboBox_SetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST), temp_type_slot1); SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), slot1_List[temp_type_slot1]->info()->descr()); _OKbutton_slot1 = false; wndConfigSlot1 = CreateDialogW(hAppInst, MAKEINTRESOURCEW(Slot1_IDDs[temp_type_slot1]), dialog, (DLGPROC)Slot1_Procs[temp_type_slot1]); //SetWindowPos(GetDlgItem(dialog, IDC_ADDONS_INFO),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); //EnableWindow(GetDlgItem(dialog, IDC_ADDONS_INFO),FALSE); //EnableWindow(GetDlgItem(dialog, IDC_ADDONS_INFO),TRUE); if ( (temp_type_slot1 == 0) || (_OKbutton_slot1) ) EnableWindow(OKbutton_slot1, TRUE); else EnableWindow(OKbutton_slot1, FALSE); return TRUE; } case WM_COMMAND: { switch (LOWORD(wparam)) { case IDOK: { int Msg = IDYES; //zero 30-aug-2012 - do we really need to reset whenever we change the slot 1 device? why should resetting matter? if thats what you want to do, then do it. //if (romloaded && (needReset_slot1 || (temp_type_slot1!=slot1_device_type)) ) //{ // Msg = MessageBox(dialog, // "After change slot1 device game will reset!\nAre you sure to continue?", "DeSmuME", // MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2); //} if (Msg == IDYES) { if (wndConfigSlot1) DestroyWindow(wndConfigSlot1); EndDialog(dialog, TRUE); } } return TRUE; case IDCANCEL: if (wndConfigSlot1) DestroyWindow(wndConfigSlot1); EndDialog(dialog, FALSE); return TRUE; case IDC_ADDONS_LIST: if (HIWORD(wparam) == CBN_SELENDOK) { temp_type_slot1 = (NDS_SLOT1_TYPE)ComboBox_GetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST)); if (temp_type_slot1 != last_type_slot1) { if (wndConfigSlot1) { DestroyWindow(wndConfigSlot1); wndConfigSlot1 = NULL; } _OKbutton_slot1 = false; wndConfigSlot1=CreateDialogW(hAppInst, MAKEINTRESOURCEW(Slot1_IDDs[temp_type_slot1]), dialog, (DLGPROC)Slot1_Procs[temp_type_slot1]); if ( (temp_type_slot1 == 0) || (_OKbutton_slot1) ) EnableWindow(OKbutton_slot1, TRUE); else EnableWindow(OKbutton_slot1, FALSE); SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), slot1_List[temp_type_slot1]->info()->descr()); last_type_slot1 = temp_type_slot1; } } return TRUE; } break; } } return FALSE; }
void BootStrap::dialogEventLoop() { log( "Starting dialogEventLoop" ); m_hwndDialog = CreateDialogW( m_module, MAKEINTRESOURCEW( IDD_PROGRESSFORM ), m_hwndParent, (DLGPROC)BootStrap::DialogProc ); m_hwndMap[ m_hwndDialog ] = this; // FIXME: error never used DWORD error = GetLastError(); m_hwndProgressBar = GetDlgItem( m_hwndDialog, IDC_PROGRESS1 ); HWND hwndLabel = GetDlgItem( m_hwndDialog, IDC_LABEL ); // EJ: Just out of interest, why do you read the string into a member at construct time and then // access the member here, instead of just calling a function that reads it straight here? //set the label from the registry key SetWindowTextW( hwndLabel, (LPCWSTR)m_strProgressLabel.c_str() ); //set the window title from the registry key SetWindowTextW( m_hwndDialog, (LPCWSTR)m_strProgressTitle.c_str() ); //Set Dialog Position to Parent position if( m_hwndParent ) { RECT parentPos; GetWindowRect( m_hwndParent, &parentPos ); RECT dialogPos; GetWindowRect( m_hwndDialog, &dialogPos ); SetWindowPos( m_hwndDialog, m_hwndParent, ( ( parentPos.left + parentPos.right ) / 2 ) - ( ( dialogPos.right - dialogPos.left ) / 2 ), ( ( parentPos.top + parentPos.bottom ) / 2 ) - ( ( dialogPos.top - dialogPos.bottom ) / 2 ), NULL, NULL, SWP_NOSIZE || SWP_ASYNCWINDOWPOS ); } setProgressRange( m_progressRange ); setProgressValue( m_progressValue ); ShowWindow( m_hwndDialog, SW_SHOWNORMAL ); log( "Dialog shown, setting event to signalled" ); SetEvent( m_progressDialogShown ); MSG message; BOOL messageVal; m_dialogThreadEnd = false; while( messageVal = GetMessage( &message, NULL, 0, 0 ) && !m_dialogThreadEnd && !m_cancel ) { if( messageVal < 0 ) { // FIXME: what about localisation here? And why are we using T-strings? std::basic_stringstream<TCHAR, std::char_traits<TCHAR>, std::allocator<TCHAR> > errorTxt; errorTxt << _T( "Event loop error " ) << GetLastError(); MessageBox( NULL, errorTxt.str().c_str(), _T( "Error..." ), MB_OK | MB_ICONEXCLAMATION ); } else { TranslateMessage( &message ); DispatchMessage( &message ); } } std::ostringstream os; os << "Dialog loop exited\nmessageVal: " << messageVal << ", m_dialogThreadEnd: " << m_dialogThreadEnd << ", m_cancel: " << m_cancel; log( os.str() ); if( m_cancel ) { closeWindow(); } }