/* Message handler for dialog box */ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam) { switch (uMessage) { case WM_SYSCOMMAND: { switch (LOWORD(wParam) /*GET_WM_COMMAND_ID(wParam, lParam)*/) { case IDM_ABOUT: DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_ABOUTBOX), hWnd, About); // break; return TRUE; } // break; return FALSE; } case WM_COMMAND: { switch (LOWORD(wParam) /*GET_WM_COMMAND_ID(wParam, lParam)*/) { case IDM_ABOUT: DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_ABOUTBOX), hWnd, About); // break; return TRUE; } break; // return FALSE; } case WM_DESTROY: { if (wpOrigEditProc) SetWindowLongPtr(hWnd, DWLP_DLGPROC, (LONG_PTR)wpOrigEditProc); if (hIcon) DestroyIcon(hIcon); if (hIconSm) DestroyIcon(hIconSm); } default: break; } /* Return */ if (wpOrigEditProc) return CallWindowProc(wpOrigEditProc, hWnd, uMessage, wParam, lParam); else return FALSE; }
/********************************************************************* * general_on_command [internal] * * handle WM_COMMAND * */ static INT_PTR general_on_command(HWND hwnd, WPARAM wparam) { switch (wparam) { case MAKEWPARAM(IDC_HOME_EDIT, EN_CHANGE): /* enable apply button */ SendMessageW(GetParent(hwnd), PSM_CHANGED, (WPARAM)hwnd, 0); break; case MAKEWPARAM(IDC_HOME_BLANK, BN_CLICKED): SetDlgItemTextW(hwnd, IDC_HOME_EDIT, about_blank); break; case MAKEWPARAM(IDC_HOME_DEFAULT, BN_CLICKED): SetDlgItemTextW(hwnd, IDC_HOME_EDIT, default_home); break; case MAKEWPARAM(IDC_HISTORY_DELETE, BN_CLICKED): DialogBoxW(hcpl, MAKEINTRESOURCEW(IDD_DELETE_HISTORY), hwnd, delhist_dlgproc); break; default: TRACE("not implemented for command: %d/%d\n", HIWORD(wparam), LOWORD(wparam)); return FALSE; } return TRUE; }
VOID CreateSettingsDlg(HWND hwnd) { DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_SETTINGS_DIALOG), hwnd, SettingsDlgProc); }
BOOL install_addon(addon_t addon_type) { if(!*ARCH_STRING) return FALSE; addon = addons_info+addon_type; p_wine_get_dos_file_name = (void*)GetProcAddress(GetModuleHandleW(kernel32_dllW), "wine_get_dos_file_name"); /* * Try to find addon .msi file in following order: * - directory stored in $dir_config_key value of HKCU/Software/Wine/$config_key key * - $datadir/$addon_subdir/ * - $INSTALL_DATADIR/wine/$addon_subdir/ * - /usr/share/wine/$addon_subdir/ * - download from URL stored in $url_config_key value of HKCU/Software/Wine/$config_key key */ if (install_from_registered_dir() == INSTALL_NEXT && install_from_default_dir() == INSTALL_NEXT && install_from_cache() == INSTALL_NEXT && (url = get_url())) DialogBoxW(hInst, addon->dialog_template, 0, installer_proc); heap_free(url); url = NULL; return TRUE; }
BOOL install_wine_gecko(BOOL silent) { HANDLE hsem; SetLastError(ERROR_SUCCESS); hsem = CreateSemaphoreA( NULL, 0, 1, "mshtml_install_semaphore"); if(GetLastError() == ERROR_ALREADY_EXISTS) { WaitForSingleObject(hsem, INFINITE); }else { /* * Try to find Gecko .cab file in following order: * - directory stored in GeckoCabDir value of HKCU/Software/MSHTML key * - $datadir/gecko * - download from URL stored in GeckoUrl value of HKCU/Software/MSHTML key */ if(!install_from_registered_dir() && !install_from_default_dir() && !silent && (url = get_url())) DialogBoxW(hInst, MAKEINTRESOURCEW(ID_DWL_DIALOG), 0, installer_proc); } ReleaseSemaphore(hsem, 1, NULL); CloseHandle(hsem); return TRUE; }
char *winpassword(pdfapp_t *app, char *filename) { char buf[1024], *s; int code; if (password) { char *p = password; password = NULL; return p; } strcpy(buf, filename); s = buf; if (strrchr(s, '\\')) s = strrchr(s, '\\') + 1; if (strrchr(s, '/')) s = strrchr(s, '/') + 1; if (strlen(s) > 32) strcpy(s + 30, "..."); sprintf(pd_filename, "The file \"%s\" is encrypted.", s); code = DialogBoxW(NULL, L"IDD_DLOGPASS", hwndframe, dlogpassproc); if (code <= 0) winerror(app, "cannot create password dialog"); if (pd_okay) return pd_password; return NULL; }
INT_PTR CreateAboutBox(void) { INT_PTR r; dialog_showing++; r = DialogBoxW(hMainInstance, MAKEINTRESOURCEW(IDD_ABOUTBOX + IDD_OFFSET), hMainDialog, AboutCallback); dialog_showing--; return r; }
SEARCHCONFIRMRESULT ConfirmSubstitute(void) { SEARCHCONFIRMRESULT Res; static DLGPROC DlgProc; if (!DlgProc) DlgProc = (DLGPROC)MakeProcInstance((FARPROC)SubstChkCallback, hInst); Res = DialogBoxW(hInst, MAKEINTRESW(IDD_SUBSTCONFIRM), hwndMain, DlgProc); return (Res); }
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); return DialogBoxW(hInstance, MAKEINTRESOURCEW(IDD_ABOUTBOX), NULL, About); }
char *wintextinput(pdfapp_t *app, char *inittext, int retry) { int code; td_retry = retry; fz_strlcpy(td_textinput, inittext ? inittext : "", sizeof td_textinput); code = DialogBoxW(NULL, L"IDD_DLOGTEXT", hwndframe, dlogtextproc); if (code <= 0) winerror(app, "cannot create text input dialog"); if (pd_okay) return td_textinput; return NULL; }
int winchoiceinput(pdfapp_t *app, int nopts, char *opts[], int *nvals, char *vals[]) { int code; cd_nopts = nopts; cd_nvals = nvals; cd_opts = opts; cd_vals = vals; code = DialogBoxW(NULL, L"IDD_DLOGLIST", hwndframe, dlogchoiceproc); if (code <= 0) winerror(app, "cannot create text input dialog"); return pd_okay; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HANDLE hProcess; HANDLE hToken; TOKEN_PRIVILEGES tkp; /* Initialize global variables */ hInst = hInstance; /* Change our priority class to HIGH */ hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId()); SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS); CloseHandle(hProcess); /* Now let's get the SE_DEBUG_NAME privilege * so that we can debug processes */ /* Get a token for this process. */ if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) { static const WCHAR SeDebugPrivilegeW[] = {'S','e','D','e','b','u','g','P','r','i','v','i','l','e','g','e',0}; /* Get the LUID for the debug privilege. */ LookupPrivilegeValueW(NULL, SeDebugPrivilegeW, &tkp.Privileges[0].Luid); tkp.PrivilegeCount = 1; /* one privilege to set */ tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; /* Get the debug privilege for this process. */ AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, 0); } /* Load our settings from the registry */ LoadSettings(); /* Initialize perf data */ if (!PerfDataInitialize()) { return -1; } DialogBoxW(hInst, (LPWSTR)IDD_TASKMGR_DIALOG, NULL, TaskManagerWndProc); /* Save our settings to the registry */ SaveSettings(); PerfDataUninitialize(); return 0; }
BOOL DoCameraUI(void) { HKEY key; DWORD data = 0; DWORD size = sizeof(data); if (RegOpenKeyExA(HKEY_CURRENT_USER, settings_key, 0, KEY_READ, &key) == ERROR_SUCCESS) { RegQueryValueExA(key, settings_value, NULL, NULL, (LPBYTE) &data, &size); RegCloseKey(key); if (data) return GetAllImages(); } return DialogBoxW(GPHOTO2_instance, (LPWSTR)MAKEINTRESOURCE(IDD_CAMERAUI),NULL, DialogProc); }
/*Отображает окно выбора числа в диапазоне от min до max с возможностью выбора размера шага*/ bool viewerShowChooseValueWindowEx(wchar_t *caption, int min, int max, int *val, int step) { viewer_cvwin_minval = min; viewer_cvwin_maxval = max; viewer_cvwin_newval = *val; viewer_cvwin_step = step; viewer_cvwin_caption = caption; if(DialogBoxW(viewer_win_hInstance, L"DIALOG_2", viewer_win_hWnd, viewerChooseValueWndProc) == 100) { *val = viewer_cvwin_newval; return true; } return false; }
void slot1Dialog(HWND hwnd) { strcpy(tmp_fat_path, slot1_GetFatDir().c_str()); strcpy(tmp_fs_path, path.getpath(path.SLOT1D).c_str()); temp_type_slot1 = slot1_GetCurrentType(); last_type_slot1 = temp_type_slot1; _OKbutton_slot1 = false; needReset_slot1 = true; u32 res=DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_SLOT1CONFIG), hwnd, (DLGPROC)Slot1Box_Proc); if (res) { switch (temp_type_slot1) { case NDS_SLOT1_NONE: if (temp_type_slot1 != slot1_GetCurrentType()) needReset_slot1 = true; else needReset_slot1 = false; break; case NDS_SLOT1_RETAIL_AUTO: case NDS_SLOT1_RETAIL_MCROM: break; case NDS_SLOT1_R4: if (strlen(tmp_fat_path)) { slot1_SetFatDir(tmp_fat_path); WritePrivateProfileString("Slot1","FAT_path",tmp_fat_path,IniName); } break; case NDS_SLOT1_RETAIL_NAND: break; case NDS_SLOT1_RETAIL_DEBUG: if (strlen(tmp_fs_path)) { path.setpath(path.SLOT1D, tmp_fs_path); WritePrivateProfileString(SECTION, SLOT1DKEY, path.pathToSlot1D, IniName); } break; default: return; } WritePrivateProfileInt("Slot1","type",temp_type_slot1,IniName); slot1_Change((NDS_SLOT1_TYPE)temp_type_slot1); return; } }
int __stdcall FsExecuteFileW(HWND MainWin, WCHAR* RemoteName, WCHAR* Verb) { INT_PTR dlgResult = 0; if(wcscmp(Verb, L"open") == 0 && wcscmp(RemoteName, L"\\[²Ù×÷]ÐÂÔöÍøÅÌ") == 0) { if(!available_disk_entries_length) { RequestProcW(PluginNumber, RT_MsgOK, L"ÅäÖôíÎó", L"ÍøÅ̽ű¾´íÎó, ûÓÐÉèÖÃÈκÎÓÐЧµÄÍøÅÌÅäÖÃÎļþ. ", NULL, 0); return FS_EXEC_ERROR; } dlgResult = DialogBoxW((HINSTANCE)hInst, MAKEINTRESOURCEW(IDD_NEW), GetActiveWindow(), NewdiskProc); if(dlgResult == IDOK) { wcslcpy(RemoteName, L"\\", PATH_MAX); return FS_EXEC_SYMLINK; } return FS_EXEC_OK; } return FS_EXEC_ERROR; }
bool InsertWatch(const AddressWatcher& Watch, HWND parent) { if(!VerifyWatchNotAlreadyAdded(Watch)) return false; if(!parent) parent = RamWatchHWnd; if(!parent) parent = MainWindow->getHWnd(); int prevWatchCount = WatchCount; rswatches[WatchCount] = Watch; rswatches[WatchCount].CurValue = GetCurrentValue(rswatches[WatchCount]); DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_PROMPT), parent, (DLGPROC) PromptWatchNameProc); return WatchCount > prevWatchCount; }
BOOL DownloadApplication(INT Index) { if (!IS_AVAILABLE_ENUM(SelectedEnumType)) return FALSE; AppInfo = (PAPPLICATION_INFO) ListViewGetlParam(Index); if (!AppInfo) return FALSE; WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_INSTALL, AppInfo->szName); DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG), hMainWnd, DownloadDlgProc); return TRUE; }
BOOL install_addon(addon_t addon_type) { if(!*ARCH_STRING) return FALSE; addon = addons_info + addon_type; /* * Try to find addon .msi file in following order: * - directory stored in $dir_config_key value of HKCU/Wine/Software/$config_key key * - download the package */ if (install_from_registered_dir() == INSTALL_NEXT) DialogBoxW(hApplet, addon->dialog_template, 0, installer_proc); return TRUE; }
void ProcessPage_OnViewSelectColumns(void) { int i; if (DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_COLUMNS_DIALOG), hMainWnd, ColumnsDialogWndProc) == IDOK) { for (i=Header_GetItemCount(hProcessPageHeaderCtrl)-1; i>=0; i--) { (void)ListView_DeleteColumn(hProcessPageListCtrl, i); } for (i=0; i<COLUMN_NMAX; i++) { TaskManagerSettings.ColumnOrderArray[i] = i; TaskManagerSettings.ColumnSizeArray[i] = ColumnPresets[i].size; } AddColumns(); } }
VOID DownloadApplicationsDB(LPCWSTR lpUrl) { APPLICATION_INFO IntInfo; ZeroMemory(&IntInfo, sizeof(APPLICATION_INFO)); if (FAILED(StringCbCopyW(IntInfo.szUrlDownload, sizeof(IntInfo.szUrlDownload), lpUrl))) { return; } AppInfo = &IntInfo; DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG), hMainWnd, DownloadDlgProc); }
/*ќтображает окно выбора числа в диапазоне от min до max*/ bool viewerShowPPaintDlgWindow(void) { if(!viewer_effect_ppaint_nofcolors) return false; viewer_ppaintdlg_nofcolors = viewer_effect_ppaint_nofcolors; viewer_ppaintdlg_colors = malloc(viewer_ppaintdlg_nofcolors*3); if(!viewer_ppaintdlg_colors) return false; memcpy(viewer_ppaintdlg_colors, viewer_effect_ppaint_colors, viewer_ppaintdlg_nofcolors*3); if(DialogBoxW(viewer_win_hInstance, L"DIALOG_4", viewer_win_hWnd, viewerPPaintDlgWndProc) == 100) { viewer_effect_ppaint_nofcolors = viewer_ppaintdlg_nofcolors; free(viewer_effect_ppaint_colors); viewer_effect_ppaint_colors = viewer_ppaintdlg_colors; viewerUpdatePPaintTable(); return true; } free(viewer_ppaintdlg_colors); return false; }
BOOL install_wine_gecko(void) { if(!*ARCH_STRING) return FALSE; /* * Try to find Gecko .cab file in following order: * - directory stored in GeckoCabDir value of HKCU/Wine/Software/MSHTML key * - $datadir/gecko/ * - $INSTALL_DATADIR/wine/gecko/ * - /usr/share/wine/gecko/ * - download from URL stored in GeckoUrl value of HKCU/Wine/Software/MSHTML key */ if(!install_from_registered_dir() && !install_from_default_dir() && (url = get_url())) DialogBoxW(hInst, MAKEINTRESOURCEW(ID_DWL_DIALOG), 0, installer_proc); heap_free(url); url = NULL; return TRUE; }
/*Показывает гистограмму изображения*/ void viewerShowHistogram(void) { unsigned char *r, *g, *b; int y; int i; if(!viewer_image_data) return; b = viewer_image_data; g = viewer_image_data+1; r = viewer_image_data+2; memset(viewer_histogram_yvalues, 0, 256*sizeof(unsigned int)); viewer_histogram_yvaluemax = 0; memset(viewer_histogram_rvalues, 0, 256*sizeof(unsigned int)); viewer_histogram_rvaluemax = 0; memset(viewer_histogram_gvalues, 0, 256*sizeof(unsigned int)); viewer_histogram_gvaluemax = 0; memset(viewer_histogram_bvalues, 0, 256*sizeof(unsigned int)); viewer_histogram_bvaluemax = 0; for(i = 0; i < viewer_image_bih.biWidth*viewer_image_bih.biHeight; i++) { y = ((*r)*30+(*g)*59+(*b)*11)/100; viewer_histogram_yvalues[y]++; viewer_histogram_rvalues[*r]++; r+=4; viewer_histogram_gvalues[*g]++; g+=4; viewer_histogram_bvalues[*b]++; b+=4; } for(i = 0; i < 256; i++) { if(viewer_histogram_yvaluemax < viewer_histogram_yvalues[i]) viewer_histogram_yvaluemax = viewer_histogram_yvalues[i]; if(viewer_histogram_rvaluemax < viewer_histogram_rvalues[i]) viewer_histogram_rvaluemax = viewer_histogram_rvalues[i]; if(viewer_histogram_gvaluemax < viewer_histogram_gvalues[i]) viewer_histogram_gvaluemax = viewer_histogram_gvalues[i]; if(viewer_histogram_bvaluemax < viewer_histogram_bvalues[i]) viewer_histogram_bvaluemax = viewer_histogram_bvalues[i]; } //if(!viewerInitHistogramWindow()) return; DialogBoxW(viewer_win_hInstance, L"DIALOG_1", viewer_win_hWnd, viewerHistogramWndProc); }
bool importSave(HWND hwnd, HINSTANCE hAppInst) { OPENFILENAME ofn; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwnd; ofn.lpstrFilter = "All supported types\0*.duc;*.sav\0Action Replay DS Save (*.duc)\0*.duc\0Raw/No$GBA Save format (*.sav)\0*.sav\0\0"; ofn.nFilterIndex = 1; ofn.lpstrFile = ImportSavFName; ofn.nMaxFile = MAX_PATH; ofn.lpstrDefExt = "duc"; ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST; char buffer[MAX_PATH] = {0}; ZeroMemory(buffer, sizeof(buffer)); path.getpath(path.BATTERY, buffer); ofn.lpstrInitialDir = buffer; if(!GetOpenFileName(&ofn)) return true; u32 res = DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_IMPORT_SAVE_SIZE), hwnd, (DLGPROC)ImportSizeSelect_Proc); if (res < MAX_SAVE_TYPES) { res = NDS_ImportSave(ImportSavFName, save_types[res+1].size); if (res) { printf("Save was successfully imported\n"); NDS_Reset(); // reboot game } else printf("Save was not successfully imported"); return res; } return (res == (MAX_SAVE_TYPES + 1)); }
/* * Display a custom notification */ BOOL Notification(int type, const notification_info* more_info, char* title, char* format, ...) { BOOL ret; va_list args; dialog_showing++; szMessageText = (char*)malloc(MAX_PATH); if (szMessageText == NULL) return FALSE; szMessageTitle = title; va_start(args, format); safe_vsnprintf(szMessageText, MAX_PATH-1, format, args); va_end(args); szMessageText[MAX_PATH-1] = 0; notification_more_info = more_info; notification_is_question = FALSE; switch(type) { case MSG_WARNING: hMessageIcon = LoadIcon(NULL, IDI_WARNING); break; case MSG_ERROR: hMessageIcon = LoadIcon(NULL, IDI_ERROR); break; case MSG_QUESTION: hMessageIcon = LoadIcon(NULL, IDI_QUESTION); notification_is_question = TRUE; break; case MSG_INFO: default: hMessageIcon = LoadIcon(NULL, IDI_INFORMATION); break; } ret = (DialogBoxW(hMainInstance, MAKEINTRESOURCEW(IDD_NOTIFICATION + IDD_OFFSET), hMainDialog, NotificationCallback) == IDYES); safe_free(szMessageText); dialog_showing--; return ret; }
/********************************************************************* * general_on_command [internal] * * handle WM_COMMAND * */ static INT_PTR general_on_command(HWND hwnd, WPARAM wparam) { WCHAR buffer[INTERNET_MAX_URL_LENGTH]; DWORD len; DWORD type; LONG res; switch (wparam) { case MAKEWPARAM(IDC_HOME_EDIT, EN_CHANGE): /* enable apply button */ SendMessageW(GetParent(hwnd), PSM_CHANGED, (WPARAM)hwnd, 0); break; case MAKEWPARAM(IDC_HOME_BLANK, BN_CLICKED): SetDlgItemTextW(hwnd, IDC_HOME_EDIT, about_blank); break; case MAKEWPARAM(IDC_HOME_DEFAULT, BN_CLICKED): len = sizeof(buffer); type = REG_SZ; res = SHRegGetUSValueW(reg_ie_main, default_page, &type, buffer, &len, FALSE, (LPBYTE) about_blank, sizeof(about_blank)); if (!res && (type == REG_SZ)) SetDlgItemTextW(hwnd, IDC_HOME_EDIT, buffer); break; case MAKEWPARAM(IDC_HISTORY_DELETE, BN_CLICKED): DialogBoxW(hcpl, MAKEINTRESOURCEW(IDD_DELETE_HISTORY), hwnd, delhist_dlgproc); break; default: TRACE("not implemented for command: %d/%d\n", HIWORD(wparam), LOWORD(wparam)); return FALSE; } return TRUE; }
void ProcessPage_OnSetAffinity(void) { DWORD dwProcessId; WCHAR strErrorText[260]; WCHAR szTitle[256]; dwProcessId = GetSelectedProcessId(); if (dwProcessId == 0) return; hProcessAffinityHandle = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId); if (!hProcessAffinityHandle) { GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(WCHAR)); LoadStringW(hInst, IDS_MSG_ACCESSPROCESSAFF, szTitle, sizeof(szTitle) / sizeof(WCHAR)); MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP); return; } DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_AFFINITY_DIALOG), hMainWnd, AffinityDialogWndProc); if (hProcessAffinityHandle) { CloseHandle(hProcessAffinityHandle); hProcessAffinityHandle = NULL; } }
BOOL install_addon(addon_t addon_type) { if(!*ARCH_STRING) return FALSE; addon = addons_info+addon_type; /* * Try to find addon .msi file in following order: * - directory stored in $dir_config_key value of HKCU/Wine/Software/$config_key key * - $datadir/$addon_subdir/ * - $INSTALL_DATADIR/wine/$addon_subdir/ * - /usr/share/wine/$addon_subdir/ * - download from URL stored in $url_config_key value of HKCU/Wine/Software/$config_key key */ if(!install_from_registered_dir() && !install_from_default_dir() && (url = get_url())) DialogBoxW(hInst, MAKEINTRESOURCEW(ID_DWL_DIALOG), 0, installer_proc); heap_free(url); url = NULL; return TRUE; }
// // FUNCTION: WndProc (HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Process the message in the main window. // // WM_COMMAND - process the application menu // WM_PAINT - draw the main window // WM_DESTROY - send a message to exit and return // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int cbIndex; static scene sceneSettings = init_scene(hWnd); params parameters; PAINTSTRUCT ps; HDC hdc; HWND bufHWND; TCHAR buf[5]; switch (message) { case WM_COMMAND: { int wmId = LOWORD(wParam); switch (wmId) { case ID_BUTTON_DRAW_ELLIPSE: cbIndex = getCurrentItem(GetDlgItem(hWnd, ID_COMBO_ELLIPSE)); bufHWND = GetDlgItem(hWnd, ID_EDIT_ELLIPSE_CENTER_X); GetWindowText(bufHWND, buf, 5); parameters.centerX = _wtoi(buf); bufHWND = GetDlgItem(hWnd, ID_EDIT_ELLIPSE_CENTER_Y); GetWindowText(bufHWND, buf, 5); parameters.centerY = _wtoi(buf); bufHWND = GetDlgItem(hWnd, ID_EDIT_ELLIPSE_HEIGHT); GetWindowText(bufHWND, buf, 5); parameters.height = _wtoi(buf); bufHWND = GetDlgItem(hWnd, ID_EDIT_ELLIPSE_WIDTH); GetWindowText(bufHWND, buf, 5); parameters.width = _wtoi(buf); draw(ELLIPSE, parameters, cbIndex, sceneSettings); break; case ID_BUTTON_DRAW_CIRCLE: cbIndex = getCurrentItem(GetDlgItem(hWnd, ID_COMBO_CIRCLE)); bufHWND = GetDlgItem(hWnd, ID_EDIT_CIRCLE_CENTER_X); GetWindowText(bufHWND, buf, 5); parameters.centerX = _wtoi(buf); bufHWND = GetDlgItem(hWnd, ID_EDIT_CIRCLE_CENTER_Y); GetWindowText(bufHWND, buf, 5); parameters.centerY = _wtoi(buf); bufHWND = GetDlgItem(hWnd, ID_EDIT_CIRCLE_RADIUS); GetWindowText(bufHWND, buf, 5); parameters.radiusMin = _wtoi(buf); parameters.radiusMax = _wtoi(buf); draw(CIRCLE, parameters, cbIndex, sceneSettings); break; case ID_BUTTON_DRAW_SPEKTRE: cbIndex = getCurrentItem(GetDlgItem(hWnd, ID_COMBO_SPEKTRE)); bufHWND = GetDlgItem(hWnd, ID_EDIT_SPEKTRE_RADIUS_MIN); GetWindowText(bufHWND, buf, 5); parameters.radiusMin = _wtoi(buf); bufHWND = GetDlgItem(hWnd, ID_EDIT_SPEKTRE_RADIUS_MAX); GetWindowText(bufHWND, buf, 5); parameters.radiusMax = _wtoi(buf); bufHWND = GetDlgItem(hWnd, ID_EDIT_SPEKTRE_RADIUS_STEP); GetWindowText(bufHWND, buf, 5); parameters.radiusStep = _wtoi(buf); draw(SPEKTRE, parameters, cbIndex, sceneSettings); break; case ID_BUTTON_CLEAR: draw_scene(sceneSettings); break; case ID_BUTTON_LCOLOR: change_color(&sceneSettings, TRUE); break; case ID_BUTTON_BCOLOR: change_color(&sceneSettings, FALSE); break; case IDM_ABOUT: DialogBoxW(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } SetFocus(hWnd); } break; case WM_PAINT: { hdc = BeginPaint(hWnd, &ps); draw_scene(sceneSettings); init_colorpick(sceneSettings); init_text(sceneSettings); EndPaint(hWnd, &ps); } break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }