BOOL CDlgLinkProperties::OnInitDialog() { CDialog::OnInitDialog(); std::map<int, DTALinkType>:: const_iterator itr; for(itr = m_pDoc->m_LinkTypeMap.begin(); itr != m_pDoc->m_LinkTypeMap.end(); itr++) { CString str; str.Format("%d,%s",itr->first,itr->second .link_type_name.c_str ()); m_LinkTypeComboBox.AddString (str); if(LinkType == itr->first) { m_LinkTypeComboBox.SetCurSel (m_LinkTypeComboBox.GetCount ()-1); } } SetDlgItemTextA(IDC_STATIC_UNIT_SPEED_LIMIT,"distance unit/hour"); SetDlgItemTextA(IDC_STATIC_UNIT_DENSITY,"(veh/distance/ln)"); EnableDataBasedOnLinkType(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
/********************************************************* *NAME: dialogPasswordCallback *AUTHOR: John Morrison *CREATION DATE: 24/1/99 *LAST MODIFIED: 29/4/00 *PURPOSE: * The Opening Dialog call back function. * *ARGUMENTS: * hWnd - Handle to the window * msg - The message * wParam - Message parameters * lParam - More Message parameters *********************************************************/ BOOL CALLBACK dialogPasswordCallback( HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam ) { char pass[MAP_STR_SIZE]; /* The password to get */ switch ( uMsg ) { case WM_INITDIALOG: /* Set languages */ SetWindowTextA(hWnd, langGetText(STR_DLGPASSWORD_TITLE)); SetDlgItemTextA(hWnd, IDC_BLURB, langGetText(STR_DLGPASSWORD_BLURB)); SetDlgItemTextA(hWnd, IDOK, langGetText(STR_OK)); SetFocus(GetDlgItem(hWnd, IDC_PASSWORD)); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: GetDlgItemText(hWnd, IDC_PASSWORD, pass, (sizeof(pass))); gameFrontSetGameOptions(pass, gameOpen, FALSE, FALSE, 0, 0, TRUE); EndDialog(hWnd, TRUE); break; } break; case WM_PAINT: break; case WM_DESTROY: break; } return FALSE; }
bool CDVSAboutPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: { #ifdef _VSMOD SetDlgItemTextA( m_Dlg, IDC_VERSION, "DirectVobSub 2.40."MAKE_STR(MPC_VERSION_PATCH)"."MAKE_STR(MPC_VERSION_REV)" "MAKE_STR(VERSION_ARCH)", MOD\nCopyright 2001-2011 MPC-HC & VSFilterMod Teams" ); #else SetDlgItemTextA( m_Dlg, IDC_VERSION, "DirectVobSub 2.40."MAKE_STR(MPC_VERSION_PATCH)"."MAKE_STR(MPC_VERSION_REV)" "MAKE_STR(VERSION_ARCH)"\nCopyright 2001-2011 MPC-HC Team" ); #endif } break; case WM_COMMAND: { switch(HIWORD(wParam)) { case BN_CLICKED: { if(LOWORD(wParam) == IDC_HOMEPAGEBTN) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); ShellExecute(m_Dlg, _T("open"), ResStr(IDS_URL_HOMEPAGE), NULL, NULL, SW_SHOWNORMAL); return(true); } else if(LOWORD(wParam) == IDC_BUGREPORTBTN) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); ShellExecute(m_Dlg, _T("open"), ResStr(IDS_URL_EMAIL), NULL, NULL, SW_SHOWNORMAL); return(true); } } break; } } break; } return(false); }
INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { CMraProto *ppro = (CMraProto*)GetWindowLongPtr(hWndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hWndDlg); SetWindowLongPtr(hWndDlg, GWLP_USERDATA, lParam); ppro = (CMraProto*)lParam; { CheckDlgButton(hWndDlg, IDC_ENABLE, db_get_b(NULL, MRA_AVT_SECT_NAME, "Enable", MRA_AVT_DEFAULT_ENABLE)); CMStringW szServer; if (DB_GetStringW(NULL, MRA_AVT_SECT_NAME, "Server", szServer)) SetDlgItemText(hWndDlg, IDC_SERVER, szServer.c_str()); else SetDlgItemTextA(hWndDlg, IDC_SERVER, MRA_AVT_DEFAULT_SERVER); SetDlgItemInt(hWndDlg, IDC_SERVERPORT, db_get_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", MRA_AVT_DEFAULT_SERVER_PORT), FALSE); CheckDlgButton(hWndDlg, IDC_USE_KEEPALIVE_CONN, db_get_b(NULL, MRA_AVT_SECT_NAME, "UseKeepAliveConn", MRA_AVT_DEFAULT_USE_KEEPALIVE_CONN)); SetDlgItemInt(hWndDlg, IDC_UPD_CHECK_INTERVAL, db_get_dw(NULL, MRA_AVT_SECT_NAME, "CheckInterval", MRA_AVT_DEFAULT_CHK_INTERVAL), FALSE); CheckDlgButton(hWndDlg, IDC_RETURN_ABC_PATH, db_get_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", MRA_AVT_DEFAULT_RET_ABC_PATH)); CheckDlgButton(hWndDlg, IDC_DELETE_AVT_ON_CONTACT_DELETE, db_get_b(NULL, MRA_AVT_SECT_NAME, "DeleteAvtOnContactDelete", MRA_DELETE_AVT_ON_CONTACT_DELETE)); EnableControlsArray(hWndDlg, (WORD*)&wMraAvatarsControlsList, SIZEOF(wMraAvatarsControlsList), IsDlgButtonChecked(hWndDlg, IDC_ENABLE)); } return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDC_ENABLE) EnableControlsArray(hWndDlg, (WORD*)&wMraAvatarsControlsList, SIZEOF(wMraAvatarsControlsList), IsDlgButtonChecked(hWndDlg, IDC_ENABLE)); if (LOWORD(wParam) == IDC_BUTTON_DEFAULT) { SetDlgItemTextA(hWndDlg, IDC_SERVER, MRA_AVT_DEFAULT_SERVER); SetDlgItemInt(hWndDlg, IDC_SERVERPORT, MRA_AVT_DEFAULT_SERVER_PORT, FALSE); } if ((LOWORD(wParam) == IDC_SERVER || LOWORD(wParam) == IDC_SERVERPORT || LOWORD(wParam) == IDC_UPD_CHECK_INTERVAL) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return FALSE; SendMessage(GetParent(hWndDlg), PSM_CHANGED, 0, 0); break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: db_set_b(NULL, MRA_AVT_SECT_NAME, "Enable", IsDlgButtonChecked(hWndDlg, IDC_ENABLE)); db_set_b(NULL, MRA_AVT_SECT_NAME, "DeleteAvtOnContactDelete", IsDlgButtonChecked(hWndDlg, IDC_DELETE_AVT_ON_CONTACT_DELETE)); db_set_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", IsDlgButtonChecked(hWndDlg, IDC_RETURN_ABC_PATH)); db_set_dw(NULL, MRA_AVT_SECT_NAME, "CheckInterval", GetDlgItemInt(hWndDlg, IDC_UPD_CHECK_INTERVAL, NULL, FALSE)); db_set_b(NULL, MRA_AVT_SECT_NAME, "UseKeepAliveConn", IsDlgButtonChecked(hWndDlg, IDC_USE_KEEPALIVE_CONN)); db_set_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE)); TCHAR szServer[MAX_PATH]; GetDlgItemText(hWndDlg, IDC_SERVER, szServer, SIZEOF(szServer)); db_set_ts(NULL, MRA_AVT_SECT_NAME, "Server", szServer); return TRUE; } break; } return FALSE; }
static INT_PTR CALLBACK gg_confoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { GGPROTO *gg = (GGPROTO *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); DWORD num; switch (msg) { case WM_INITDIALOG: gg = (GGPROTO *)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); TranslateDialogDefault(hwndDlg); SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_TOTAL, CB_ADDSTRING, 0, (LPARAM)TranslateT("Allow")); SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_TOTAL, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ask")); SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_TOTAL, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore")); SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_TOTAL, CB_SETCURSEL, gg->getWord(GG_KEY_GC_POLICY_TOTAL, GG_KEYDEF_GC_POLICY_TOTAL), 0); if (num = gg->getWord(GG_KEY_GC_COUNT_TOTAL, GG_KEYDEF_GC_COUNT_TOTAL)) SetDlgItemTextA(hwndDlg, IDC_GC_COUNT_TOTAL, ditoa(num)); SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_UNKNOWN, CB_ADDSTRING, 0, (LPARAM)TranslateT("Allow")); SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_UNKNOWN, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ask")); SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_UNKNOWN, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore")); SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_UNKNOWN, CB_SETCURSEL, gg->getWord(GG_KEY_GC_POLICY_UNKNOWN, GG_KEYDEF_GC_POLICY_UNKNOWN), 0); if (num = gg->getWord(GG_KEY_GC_COUNT_UNKNOWN, GG_KEYDEF_GC_COUNT_UNKNOWN)) SetDlgItemTextA(hwndDlg, IDC_GC_COUNT_UNKNOWN, ditoa(num)); SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_DEFAULT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Allow")); SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_DEFAULT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ask")); SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_DEFAULT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore")); SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_DEFAULT, CB_SETCURSEL, gg->getWord(GG_KEY_GC_POLICY_DEFAULT, GG_KEYDEF_GC_POLICY_DEFAULT), 0); break; case WM_COMMAND: if ((LOWORD(wParam) == IDC_GC_COUNT_TOTAL || LOWORD(wParam) == IDC_GC_COUNT_UNKNOWN) && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) return 0; SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_NOTIFY: switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: char str[128]; // Write groupchat policy gg->setWord(GG_KEY_GC_POLICY_TOTAL, (WORD)SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_TOTAL, CB_GETCURSEL, 0, 0)); gg->setWord(GG_KEY_GC_POLICY_UNKNOWN, (WORD)SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_UNKNOWN, CB_GETCURSEL, 0, 0)); gg->setWord(GG_KEY_GC_POLICY_DEFAULT, (WORD)SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_DEFAULT, CB_GETCURSEL, 0, 0)); GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_TOTAL, str, _countof(str)); gg->setWord(GG_KEY_GC_COUNT_TOTAL, (WORD)atoi(str)); GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_UNKNOWN, str, _countof(str)); gg->setWord(GG_KEY_GC_COUNT_UNKNOWN, (WORD)atoi(str)); } break; } return FALSE; }
BOOL CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { struct ErrorWindowData *ewd = (struct ErrorWindowData *) GetWindowLong(hwndDlg, GWL_USERDATA); //if (ewd==NULL && msg!=WM_INITDIALOG) return FALSE; switch (msg) { case WM_INITDIALOG: { RECT rc, rcParent; char caption[2048]; ewd = (struct ErrorWindowData *) lParam; SetWindowLong(hwndDlg, GWL_USERDATA, (LONG) ewd); TranslateDialogDefault(hwndDlg); if (ewd != NULL) { if (!ewd->szDescription) ewd->szDescription = strdup(Translate("An unknown error has occured.")); if (!ewd->szText) ewd->szText = strdup(""); if (!ewd->szName) ewd->szName = strdup(""); SetDlgItemTextA(hwndDlg, IDC_ERRORTEXT, ewd->szDescription); #if defined( _UNICODE ) SetDlgItemTextW(hwndDlg, IDC_MSGTEXT, (TCHAR *)(ewd->szText + strlen(ewd->szText) + 1)); #else SetDlgItemTextA(hwndDlg, IDC_MSGTEXT, ewd->szText); #endif sprintf(caption, "%s - %s", Translate("Send Error"), ewd->szName); SetWindowTextA(hwndDlg, caption); GetWindowRect(hwndDlg, &rc); GetWindowRect(ewd->hwndParent, &rcParent); SetWindowPos(hwndDlg, HWND_TOP, rcParent.left + (rcParent.right - rcParent.left - rc.right + rc.left) / 2, rcParent.top + (rcParent.bottom - rcParent.top - rc.bottom + rc.top), 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); } } return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: SendMessage(ewd->hwndParent, DM_ERRORDECIDED, MSGERROR_RETRY, (LPARAM) ewd); DestroyWindow(hwndDlg); break; case IDCANCEL: SendMessage(ewd->hwndParent, DM_ERRORDECIDED, MSGERROR_CANCEL, (LPARAM) ewd); DestroyWindow(hwndDlg); break; } break; case WM_DESTROY: SetWindowLong(hwndDlg, GWL_USERDATA, (LONG) NULL); free(ewd->szName); free(ewd->szDescription); free(ewd->szText); free(ewd); break; } return FALSE; }
INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwnd); { MCONTACT hContact = (MCONTACT)((PROPSHEETPAGE*)lParam)->lParam; char name[2048]; SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)hContact); if (db_get_static(hContact, MODNAME, "Name", name, _countof(name))) break; SetDlgItemTextA(hwnd, IDC_DISPLAY_NAME, name); if (db_get_static(hContact, MODNAME, "ToolTip", name, _countof(name))) break; SetDlgItemTextA(hwnd, IDC_TOOLTIP, name); } return TRUE; case WM_COMMAND: SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); return TRUE; case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (GetWindowTextLength(GetDlgItem(hwnd, IDC_DISPLAY_NAME))) { char text[512]; GetDlgItemTextA(hwnd, IDC_DISPLAY_NAME, text, _countof(text)); db_set_s(hContact, MODNAME, "Name", text); WriteSetting(hContact, MODNAME, "Name", MODNAME, "Nick"); } else { db_unset(hContact, MODNAME, "Name"); db_unset(hContact, MODNAME, "Nick"); } if (GetWindowTextLength(GetDlgItem(hwnd, IDC_TOOLTIP))) { char text[2048]; GetDlgItemTextA(hwnd, IDC_TOOLTIP, text, _countof(text)); db_set_s(hContact, MODNAME, "ToolTip", text); WriteSetting(hContact, MODNAME, "ToolTip", "UserInfo", "MyNotes"); } else { db_unset(hContact, MODNAME, "ToolTip"); db_unset(hContact, "UserInfo", "MyNotes"); } } return TRUE; } break; } return FALSE; }
static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack) { /* locale string */ if (!(pack->flags & LPF_NOLOCALE)) { TCHAR szLocaleName[128]; szLocaleName[0] = _T('\0'); /* can't use LOCALE_SNAME as it is not present on pre WinVista */ if (!GetLocaleInfo(pack->Locale, LOCALE_SISO639LANGNAME, szLocaleName, SIZEOF(szLocaleName))) { /* Win98/NT4+ */ if (!GetLocaleInfo(pack->Locale, LOCALE_SLANGUAGE, szLocaleName, SIZEOF(szLocaleName))) /* not unique! */ szLocaleName[0] = _T('\0'); } else { if (GetLocaleInfo(pack->Locale, LOCALE_SISO3166CTRYNAME, &szLocaleName[3], SIZEOF(szLocaleName) - 3)) /* Win98/NT4+ */ szLocaleName[2] = _T('-'); } /* add some note if its incompatible */ if (szLocaleName[0]) { if (!IsValidLocale(pack->Locale, LCID_INSTALLED)) { TCHAR *pszIncompat; pszIncompat = TranslateT("(incompatible)"); szLocaleName[SIZEOF(szLocaleName) - lstrlen(pszIncompat) - 1] = 0; lstrcat(lstrcat(szLocaleName, _T(" ")), pszIncompat); /* buffer safe */ } SetDlgItemText(hwndDlg, IDC_LANGLOCALE, szLocaleName); } else SetDlgItemText(hwndDlg, IDC_LANGLOCALE, TranslateT("Unknown")); } else SetDlgItemText(hwndDlg, IDC_LANGLOCALE, TranslateT("Current")); /* file date */ SYSTEMTIME stFileDate; TCHAR szDate[128]; szDate[0] = _T('\0'); if (FileTimeToSystemTime(&pack->ftFileDate, &stFileDate)) GetDateFormat((LCID)CallService(MS_LANGPACK_GETLOCALE, 0, 0), DATE_SHORTDATE, &stFileDate, NULL, szDate, SIZEOF(szDate)); SetDlgItemText(hwndDlg, IDC_LANGDATE, szDate); /* version */ SetDlgItemTextA(hwndDlg, IDC_LANGVERSION, pack->szVersion); if (pack->szVersion[0] && pack->szFLName[0]) { if (!IsWindowVisible(GetDlgItem(hwndDlg, IDC_LANGVERSIONLABEL))) { ShowWindow(GetDlgItem(hwndDlg, IDC_LANGVERSIONLABEL), SW_SHOW); ShowWindow(GetDlgItem(hwndDlg, IDC_LANGVERSION), SW_SHOW); } } else { ShowWindow(GetDlgItem(hwndDlg, IDC_LANGVERSIONLABEL), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_LANGVERSION), SW_HIDE); } /* general */ SetDlgItemTextA(hwndDlg, IDC_LANGMODUSING, pack->szLastModifiedUsing); SetDlgItemTextA(hwndDlg, IDC_LANGAUTHORS, pack->szAuthors); SetDlgItemTextA(hwndDlg, IDC_LANGEMAIL, pack->szAuthorEmail); SetDlgItemText(hwndDlg, IDC_LANGINFOFRAME, TranslateTS(pack->szLanguage)); }
static INT_PTR CALLBACK PromptForInputDialogProc(HWND dialogHandle, UINT message, WPARAM wParam, LPARAM lParam) { BOOL result = TRUE; // Initialization if (message == WM_INITDIALOG) { // Text initialization TInputDialogInitInfo *pInfo = reinterpret_cast<TInputDialogInitInfo *>(lParam); SetWindowTextA(dialogHandle, pInfo->get<1>().c_str()); SetDlgItemTextA(dialogHandle, IDC_PROMPT, pInfo->get<2>().c_str()); SetDlgItemTextA(dialogHandle, IDC_EDIT_CONTENT, pInfo->get<3>().c_str()); SetDlgItemTextA(dialogHandle, IDOK, pInfo->get<4>().c_str()); SetDlgItemTextA(dialogHandle, IDCANCEL, pInfo->get<5>().c_str()); } // Clicked button else if (message == WM_COMMAND) { // ID that triggered UINT id = LOWORD(wParam); // Clicked "OK" or "Cancel" if (id == IDOK || id == IDCANCEL) { // TODO: Duplicate code. SInputInfo *pInfo = reinterpret_cast<SInputInfo *>(malloc(sizeof(SInputInfo))); if (pInfo) { pInfo->isOkClicked = (id == IDOK); GetDlgItemTextA(dialogHandle, IDC_EDIT_CONTENT, pInfo->text, sizeof(pInfo->text)); } EndDialog(dialogHandle, reinterpret_cast<INT_PTR>(pInfo)); } } // Clicked close else if (message == WM_CLOSE) { // TODO: Duplicate code. SInputInfo *pInfo = reinterpret_cast<SInputInfo *>(malloc(sizeof(SInputInfo))); if (pInfo) { pInfo->isOkClicked = false; GetDlgItemTextA(dialogHandle, IDC_EDIT_CONTENT, pInfo->text, sizeof(pInfo->text)); } EndDialog(dialogHandle, reinterpret_cast<INT_PTR>(pInfo)); } // Messages that not interested else { result = FALSE; } return result; }
static RETERR16 VCP_UI_CopyStart(void) { LPCVOID template32; char buf[256]; /* plenty */ BOOL dirty; DWORD len; /* FIXME: should be registered at DLL startup instead */ VCP_UI_RegisterProgressClass(); if (!(VCP_UI_GetDialogTemplate(&template32))) return VCPN_FAIL; if (vn_num > 10) /* hack */ { hDlgCopy = CreateDialogIndirectParamA(SETUPAPI_hInstance, template32, 0, VCP_UI_FileCopyDlgProc, 0); if (!hDlgCopy) return VCPN_FAIL; SetDlgItemTextA(hDlgCopy, SOURCESTRORD, "Scanning ..."); SetDlgItemTextA(hDlgCopy, DESTSTRORD, "NOT_IMPLEMENTED_YET"); } strcpy(buf, REG_INSTALLEDFILES); if (RegCreateKeyA(HKEY_LOCAL_MACHINE, buf, &hKeyFiles)) return VCPN_FAIL; strcat(buf, REGPART_RENAME); if (RegCreateKeyA(HKEY_LOCAL_MACHINE, buf, &hKeyRename)) return VCPN_FAIL; if (RegCreateKeyA(HKEY_LOCAL_MACHINE, REG_VERSIONCONFLICT, &hKeyConflict)) return VCPN_FAIL; len = 1; if (!(RegQueryValueExA(hKeyConflict, "Dirty", NULL, 0, (LPBYTE)&dirty, &len))) { /* FIXME: what does SETUPX.DLL do in this case ? */ MESSAGE("Warning: another program using SETUPX is already running ! Failed.\n"); return VCPN_FAIL; } dirty = TRUE; if (RegSetValueExA(hKeyConflict, "Dirty", 0, REG_BINARY, (LPBYTE)&dirty, 1)) return VCPN_FAIL; len = 12; if (!(RegQueryValueExA(hKeyConflict, "BackupDirectory", NULL, 0, (LPBYTE)BackupDir, &len))) strcpy(BackupDir, "VCM"); /* create C:\WINDOWS\[BackupDir] and set registry key to it */ GetWindowsDirectoryA(buf, 256); strcat(buf, "\\"); strcat(buf, BackupDir); if (!(CreateDirectoryA(buf, NULL))) return VCPN_FAIL; if (RegSetValueExA(hKeyConflict, "BackupDirectory", 0, REG_SZ, (LPBYTE)buf, strlen(buf)+1)) return VCPN_FAIL; RegCloseKey(hKeyConflict); return VCPN_OK; }
// Initialization void VwOnInit(HWND hWnd) { inited = false; if (IsSupportedOs() == false) { // The OS is unsupported Hide(hWnd, P_PROGRESS); SetDlgItemTextA(hWnd, S_INFO, msgNotSupported); return; } if(data.VpnServerManagerMode == FALSE) { SetText(hWnd, S_INFO2, msgStartTextForVpnClient); SetText(hWnd, B_START, msgButtonForVpnClient); } else { SetText(hWnd, S_INFO2, msgStartTextForVpnServer); SetText(hWnd, B_START, msgButtonForVpnServer); } if (lstrlen(data.InstallerExeUrl) == 0 || lstrlen(data.InstallerInfUrl) == 0) { // Parameter is not specified Hide(hWnd, P_PROGRESS); SetDlgItemTextA(hWnd, S_INFO, msgNoParam); return; } if (data.VpnServerManagerMode == FALSE) { Show(hWnd, S_ICON_VPN); Hide(hWnd, S_ICON_SERVER); } else { Show(hWnd, S_ICON_SERVER); Hide(hWnd, S_ICON_VPN); } Hide(hWnd, P_PROGRESS); Hide(hWnd, S_INFO); Show(hWnd, S_INFO2); Show(hWnd, B_START); clicked_flag = false; Zero(&task, sizeof(task)); }
void upsStatus::Update(StatMgr *statmgr) { // Bail if window is not open WaitForSingleObject(_mutex, INFINITE); if (!_hwnd) { ReleaseMutex(_mutex); return; } // Fetch full status from nutupsd list<string> keys, values; if (!statmgr->GetAll(keys, values) || keys.empty()) { ReleaseMutex(_mutex); return; } // Update listview list<string>* data[] = {&keys, &values}; _grid->UpdateAll(data); // Update battery _bmeter->Set(atoi(statmgr->Get("battery.charge").c_str())); // Update load _lmeter->Set(atoi(statmgr->Get("ups.load").c_str())); // Update status char str[128]; string stat = statmgr->Get("ups.status"); GetDlgItemTextA(_hwnd, IDC_STATUS, str, sizeof(str)); if (stat != str) SetDlgItemTextA(_hwnd, IDC_STATUS, stat.c_str()); // Update runtime string runtime = statmgr->Get("battery.runtime"); GetDlgItemTextA(_hwnd, IDC_RUNTIME, str, sizeof(str)); if (runtime != str) SetDlgItemTextA(_hwnd, IDC_RUNTIME, runtime.c_str()); // Update title bar char name[512]; string upsname = statmgr->Get("UPS"); snprintf(name, sizeof(name), "Status for UPS: %s", upsname.c_str()); SetWindowTextA(_hwnd, name); ReleaseMutex(_mutex); }
INT CALLBACK dlogaboutproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_INITDIALOG: SetDlgItemTextA(hwnd, 2, pdfapp_version(&gapp)); SetDlgItemTextA(hwnd, 3, pdfapp_usage(&gapp)); return TRUE; case WM_COMMAND: EndDialog(hwnd, 1); return TRUE; } return FALSE; }
void ALERT::OnClickList1(NMHDR *pNMHDR, LRESULT *pResult) { LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR); // TODO: Add your control notification handler code here CListCtrl *pListctrl = (CListCtrl *)GetDlgItem(IDC_LIST1); if (pListctrl->GetItemText(pNMItemActivate->iItem, 0) == "1") { ((CButton*)GetDlgItem(IDC_CHECK1))->SetCheck(TRUE); } else ((CButton*)GetDlgItem(IDC_CHECK1))->SetCheck(FALSE); SetDlgItemTextA(IDC_EDIT1, pListctrl->GetItemText(pNMItemActivate->iItem, 1)); SetDlgItemTextA(IDC_EDIT2, pListctrl->GetItemText(pNMItemActivate->iItem, 2)); SetDlgItemTextA(IDC_EDIT3, pListctrl->GetItemText(pNMItemActivate->iItem, 3)); SetDlgItemTextA(IDC_EDIT5, pListctrl->GetItemText(pNMItemActivate->iItem, 4)); *pResult = 0; }
// “关于”框的消息处理程序。 INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: SetDlgItemTextA(hDlg, ID_CODENAME, codename_str ); return (INT_PTR)TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDURL && HIWORD(wParam) == BN_CLICKED) { ShellExecute(NULL, TEXT("open"), TEXT("http://aean.net/"), NULL, NULL, SW_SHOWNORMAL); EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; } else if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; } break; } return (INT_PTR)FALSE; }
INT CALLBACK dlogpassproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_INITDIALOG: SetDlgItemTextA(hwnd, 4, pd_filename); return TRUE; case WM_COMMAND: switch(wParam) { case 1: pd_okay = 1; GetDlgItemTextA(hwnd, 3, pd_password, sizeof pd_password); EndDialog(hwnd, 1); return TRUE; case 2: pd_okay = 0; EndDialog(hwnd, 1); return TRUE; } break; } return FALSE; }
INT_PTR CALLBACK dlogpassproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_INITDIALOG: SetDlgItemTextA(hwnd, 4, pd_filename); return TRUE; case WM_COMMAND: switch(wParam) { case 1: pd_okay = 1; GetDlgItemTextW(hwnd, 3, pd_passwordw, nelem(pd_passwordw)); EndDialog(hwnd, 1); WideCharToMultiByte(CP_UTF8, 0, pd_passwordw, -1, pd_password, sizeof pd_password, NULL, NULL); return TRUE; case 2: pd_okay = 0; EndDialog(hwnd, 1); return TRUE; } break; } return FALSE; }
BOOL SetDlgItemTextUTF8(HWND hDlg, int nIDDlgItem, LPCSTR lpString) { _bstr_t s = ConvertCodepage(lpString, CP_UTF8); if (s.length() != 0) return SetDlgItemTextW(hDlg, nIDDlgItem, s); else return SetDlgItemTextA(hDlg, nIDDlgItem, lpString); }
/* * Generate a management command from user input and send it */ BOOL ManagementCommandFromInput(connection_t *c, LPSTR fmt, HWND hDlg, int id) { BOOL retval = FALSE; LPSTR input, cmd; int input_len, cmd_len; GetDlgItemTextUtf8(hDlg, id, &input, &input_len); cmd_len = input_len + strlen(fmt); cmd = malloc(cmd_len); if (cmd) { snprintf(cmd, cmd_len, fmt, input); retval = ManagementCommand(c, cmd, NULL, regular); free(cmd); } /* Clear buffers with potentially secret content */ memset(input, 'x', input_len - 1); SetDlgItemTextA(hDlg, id, input); free(input); return retval; }
INT CALLBACK dlogaboutproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_INITDIALOG: SetDlgItemTextA(hwnd, 0x10, gapp.filename); SetDlgItemTextA(hwnd, 2, "MuPDF is Copyright (C) 2006-2008 artofcode, LLC"); SetDlgItemTextA(hwnd, 3, pdfapp_usage(&gapp)); return TRUE; case WM_COMMAND: EndDialog(hwnd, 0); return TRUE; } return FALSE; }
LRESULT CALLBACK AboutProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM) { char buf[48]; DWORD d; switch(message){ case WM_INITDIALOG: setDlgTexts(hWnd, 11); d=getVer(); sprintf(buf, "%d.%d", HIWORD(d), LOWORD(d)); SetDlgItemTextA(hWnd, 101, buf); return TRUE; case WM_COMMAND: switch(wParam){ case IDOK: case IDCANCEL: EndDialog(hWnd, wParam); return TRUE; case 123: GetDlgItemTextA(hWnd, wParam, buf, sizeA(buf)-13); if(!_tcscmp(lang, _T("English"))) strcat(buf, "/indexEN.html"); ShellExecuteA(0, 0, buf, 0, 0, SW_SHOWNORMAL); break; } break; } return FALSE; }
/********************************************************* *NAME: dialogGameFinderBuildList *AUTHOR: John Morrison *Creation Date: 18/1/00 *Last Modified: 23/1/00 *PURPOSE: * Fills the list box with the current games * *ARGUMENTS: * hWnd - Handle to the window *********************************************************/ void dialogGameFinderBuildList(HWND hWnd) { HWND hList; /* The list box handle */ HWND hJoin; /* The join button */ int count; /* Looping variable */ int total; /* Total number of games found */ char server[FILENAME_MAX]; /* Server name */ total = currentGamesItemCount(&cg); hJoin = GetDlgItem(hWnd, ID_JOIN); EnableWindow(hJoin, FALSE); EnableWindow(GetDlgItem(hWnd, ID_REJOIN), FALSE); if (total > 0) { count = 1; hList = GetDlgItem(hWnd, IDC_LIST); while (count <= total) { currentGamesGetServerName(&cg, count, server); SendMessage(hList, LB_ADDSTRING, 0, (LPARAM) server); SendMessage(hList, LB_SETITEMDATA, count-1, (LPARAM) count-1); count++; } } else { /* Display no games found message */ SetDlgItemTextA(hWnd, IDC_STATUS, langGetText(STR_DLGGAMEFINDER_NOGAMESINPROGRESS)); } }
/************************************************************************** * IShellBrowserImpl_ICommDlgBrowser_OnStateChange */ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *iface, IShellView *ppshv, ULONG uChange) { IShellBrowserImpl *This = impl_from_ICommDlgBrowser(iface); TRACE("(%p shv=%p)\n", This, ppshv); switch (uChange) { case CDBOSC_SETFOCUS: /* FIXME: Reset the default button. This should be taken care of by defdlg. If control other than button receives focus the default button should be restored. */ SendMessageA(This->hwndOwner, DM_SETDEFID, IDOK, 0); break; case CDBOSC_KILLFOCUS: { FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save"); } break; case CDBOSC_SELCHANGE: return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv); case CDBOSC_RENAME: /* nothing to do */ break; } return NOERROR; }
static INT_PTR CALLBACK EditUserEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_INITDIALOG: SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)lParam); if(*(char*)lParam) SetWindowText(hwndDlg,TranslateT("Edit E-Mail Address")); TranslateDialogDefault(hwndDlg); SetDlgItemTextA(hwndDlg,IDC_EMAIL,(char*)lParam); EnableWindow(GetDlgItem(hwndDlg,IDOK),*(char*)lParam); return TRUE; case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: GetDlgItemTextA(hwndDlg,IDC_EMAIL,(char*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA),256); //fall through case IDCANCEL: EndDialog(hwndDlg,wParam); case IDC_EMAIL: if(HIWORD(wParam)==EN_CHANGE) EnableWindow(GetDlgItem(hwndDlg,IDOK),GetWindowTextLength(GetDlgItem(hwndDlg,IDC_EMAIL))); break; } break; } return FALSE; }
static BOOL CALLBACK beeLogoDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { // начало if (uMsg == WM_INITDIALOG) { blob_t str = 0; // печать информации о версии beePrintBuildInfo(&str); if (str != 0) { SetDlgItemTextA(hDlg, 102, (const char*)str); blobClose(str); } return TRUE; } // выход if (uMsg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED && (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)) { EndDialog(hDlg, 0); return TRUE; } return FALSE; }
BOOL CALLBACK Dialog_About(HWND Window, UINT Message, WPARAM WParam, LPARAM LParam) { switch(Message) { case WM_INITDIALOG: { g_Window.SetTitle(Window, "%s [%s] :: About", APP_NAME, APP_VERSION_T); // ---- CString Text; // ---- Text.Format("%s", APP_NAME); SetDlgItemTextA(Window, IDC_APPNAME, Text); // ---- Text.Format("%s", APP_VERSION_T); SetDlgItemTextA(Window, IDC_APPVERSION, Text); // ---- Text.Format("%s", APP_DES); SetDlgItemTextA(Window, IDC_APPDES, Text); // ---- Text.Format("%s", __DATE__); SetDlgItemTextA(Window, IDC_APPDATE, Text); } break; // -- case WM_COMMAND: { switch(WParam) { case IDOK: { ShellExecute(NULL, "open", "http://z-team.pro", NULL, NULL, SW_SHOWNORMAL); EndDialog(Window, false); } break; } } break; // -- case WM_CLOSE: { EndDialog(Window, false); } break; } // ---- return 0; }
INT_PTR CALLBACK ChatRequestDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { InviteChatReqParam* param = (InviteChatReqParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (uMsg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); param = (InviteChatReqParam*)lParam; Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_YAHOO)); SetDlgItemTextA(hwndDlg, IDC_SCREENNAME, param->who); SetDlgItemText(hwndDlg, IDC_MSG, param->msg); SetDlgItemText(hwndDlg, IDC_MSG2, TranslateT("No, thank you...")); break; case WM_CLOSE: DestroyWindow(hwndDlg); break; case WM_NCDESTROY: Window_FreeIcon_IcoLib(hwndDlg); delete param; break; case WM_COMMAND: { CYahooProto::ChatRoom *cm = param->ppro->m_chatrooms.find((CYahooProto::ChatRoom*)¶m->room); switch (LOWORD(wParam)) { case IDOK: if (cm) { param->ppro->ChatStart(param->room); for (YList *l = cm->members; l; l = l->next) param->ppro->ChatEvent(param->room, (char*)l->data, GC_EVENT_JOIN); yahoo_conference_logon(param->ppro->m_id, NULL, cm->members, param->room); } DestroyWindow(hwndDlg); break; case IDCANCEL: if (cm) { TCHAR msg[1024]; GetDlgItemText(hwndDlg, IDC_MSG2, msg, _countof(msg)); yahoo_conference_decline(param->ppro->m_id, NULL, cm->members, param->room, T2Utf(msg)); param->ppro->m_chatrooms.remove((CYahooProto::ChatRoom*)¶m->room); } DestroyWindow(hwndDlg); break; } } break; } return FALSE; }
/********************************************************* *NAME: dialogLanguagesSetText *AUTHOR: John Morrison *CREATION DATE: 29/4/00 *LAST MODIFIED: 29/4/00 *PURPOSE: * Sets the text in the dialog box * *ARGUMENTS: * hWnd - Handle to the window *********************************************************/ void dialogLanguagesSetText(HWND hWnd) { /* Set dialog language text */ SetDlgItemTextA(hWnd, IDOK, langGetText(STR_OK)); SetDlgItemTextA(hWnd, IDCANCEL, langGetText(STR_CANCEL)); SetDlgItemTextA(hWnd, IDC_LANGNAMES, langGetText(STR_DLGLANG_NAME_CAPTION)); SetDlgItemTextA(hWnd, IDC_LANGNAME, langGetText(STR_DLGLANG_NAME)); SetDlgItemTextA(hWnd, IDC_AUTHORS, langGetText(STR_DLGLANG_AUTHOR_CAPTION)); SetDlgItemTextA(hWnd, IDC_AUTHOR, langGetText(STR_DLGLANG_AUTHOR)); SetDlgItemTextA(hWnd, IDC_NOTESS, langGetText(STR_DLGLANG_NOTES_CAPTION)); SetDlgItemTextA(hWnd, IDC_NOTES, langGetText(STR_DLGLANG_NOTES)); SetDlgItemTextA(hWnd, IDC_DEFAULT, langGetText(STR_DLGLANG_DEFAULTNOTE)); SetWindowTextA(hWnd, langGetText(STR_DLGLANG_TITLE)); }
static void SetDialogField(CJabberProto *ppro, HWND hwndDlg, int nDlgItem, char* key, bool bTranslate = false) { ptrT tszValue(ppro->getTStringA(key)); if (tszValue != NULL) SetDlgItemText(hwndDlg, nDlgItem, (bTranslate) ? TranslateTS(tszValue) : tszValue); else SetDlgItemTextA(hwndDlg, nDlgItem, ""); }
void ProjectConfigDialog::onScreenDirectionChanged(void) { char buff[32] = {0}; GetDlgItemTextA(m_hwndDialog, IDC_EDIT_SCREEN_WIDTH, buff, 30); int w = atoi(buff); GetDlgItemTextA(m_hwndDialog, IDC_EDIT_SCREEN_HEIGHT, buff, 30); int h = atoi(buff); bool isLandscape = IsDlgButtonChecked(m_hwndDialog, IDC_RADIO_LANDSCAPE) == BST_CHECKED; if ((isLandscape && w < h) || (!isLandscape && w > h)) { sprintf_s(buff, "%d", h); SetDlgItemTextA(m_hwndDialog, IDC_EDIT_SCREEN_WIDTH, buff); sprintf_s(buff, "%d", w); SetDlgItemTextA(m_hwndDialog, IDC_EDIT_SCREEN_HEIGHT, buff); } }