mirror of https://github.com/OpenVPN/openvpn-gui
commit
ef11bc2366
|
@ -354,9 +354,54 @@ FillLangListProc(UNUSED HANDLE module, UNUSED PTSTR type, UNUSED PTSTR stringId,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
GetLaunchOnStartup()
|
||||
{
|
||||
|
||||
WCHAR regPath[MAX_PATH], exePath[MAX_PATH];
|
||||
BOOL result = FALSE;
|
||||
HKEY regkey;
|
||||
|
||||
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_READ, ®key) == ERROR_SUCCESS) {
|
||||
|
||||
if (GetRegistryValue(regkey, L"OpenVPN-GUI", regPath, MAX_PATH) &&
|
||||
GetModuleFileNameW(NULL, exePath, MAX_PATH)) {
|
||||
if (_wcsicmp(regPath, exePath) == 0)
|
||||
result = TRUE;
|
||||
}
|
||||
|
||||
RegCloseKey(regkey);
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
SetLaunchOnStartup(BOOL value)
|
||||
{
|
||||
|
||||
WCHAR exePath[MAX_PATH];
|
||||
HKEY regkey;
|
||||
|
||||
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_WRITE, ®key) == ERROR_SUCCESS) {
|
||||
|
||||
if (value) {
|
||||
if (GetModuleFileNameW(NULL, exePath, MAX_PATH))
|
||||
SetRegistryValue(regkey, L"OpenVPN-GUI", exePath);
|
||||
}
|
||||
else
|
||||
RegDeleteValue(regkey, L"OpenVPN-GUI");
|
||||
|
||||
RegCloseKey(regkey);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK
|
||||
LanguageSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lParam)
|
||||
GeneralSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LPPSHNOTIFY psn;
|
||||
langProcData langData = {
|
||||
|
@ -379,6 +424,9 @@ LanguageSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lPa
|
|||
/* Clear language id data for the selected item */
|
||||
ComboBox_SetItemData(langData.languages, ComboBox_GetCurSel(langData.languages), 0);
|
||||
|
||||
if (GetLaunchOnStartup())
|
||||
Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_STARTUP), BST_CHECKED);
|
||||
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
|
@ -391,6 +439,8 @@ LanguageSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lPa
|
|||
if (langId != 0)
|
||||
SetGUILanguage(langId);
|
||||
|
||||
SetLaunchOnStartup(Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_STARTUP)) == BST_CHECKED);
|
||||
|
||||
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,6 @@ LPCDLGTEMPLATE LocalizedDialogResource(const UINT);
|
|||
INT_PTR LocalizedDialogBoxParam(const UINT, DLGPROC, const LPARAM);
|
||||
HWND CreateLocalizedDialogParam(const UINT, DLGPROC, const LPARAM);
|
||||
HWND CreateLocalizedDialog(const UINT, DLGPROC);
|
||||
INT_PTR CALLBACK LanguageSettingsDlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||
INT_PTR CALLBACK GeneralSettingsDlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
#endif
|
||||
|
|
2
main.c
2
main.c
|
@ -486,7 +486,7 @@ ShowSettingsDialog()
|
|||
psp[page_number].dwFlags = PSP_DLGINDIRECT;
|
||||
psp[page_number].hInstance = o.hInstance;
|
||||
psp[page_number].pResource = LocalizedDialogResource(ID_DLG_GENERAL);
|
||||
psp[page_number].pfnDlgProc = LanguageSettingsDlgProc;
|
||||
psp[page_number].pfnDlgProc = GeneralSettingsDlgProc;
|
||||
psp[page_number].lParam = 0;
|
||||
psp[page_number].pfnCallback = NULL;
|
||||
++page_number;
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
#define ID_DLG_GENERAL 230
|
||||
#define ID_CMB_LANGUAGE 231
|
||||
#define ID_TXT_LANGUAGE 232
|
||||
#define ID_CHK_STARTUP 233
|
||||
|
||||
/* Proxy Auth Dialog */
|
||||
#define ID_DLG_PROXY_AUTH 250
|
||||
|
|
|
@ -130,6 +130,8 @@ BEGIN
|
|||
GROUPBOX "Benutzeroberfläche", 201, 6, 12, 235, 30
|
||||
LTEXT "Sprache:", ID_TXT_LANGUAGE, 17, 25, 29, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 51, 23, 177, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -131,6 +131,8 @@ BEGIN
|
|||
GROUPBOX "Brugergrænseflade", 201, 6, 12, 235, 30
|
||||
LTEXT "Language:", ID_TXT_LANGUAGE, 17, 25, 52, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 57, 23, 171, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -130,6 +130,8 @@ BEGIN
|
|||
GROUPBOX "User Interface", 201, 6, 12, 235, 30
|
||||
LTEXT "Language:", ID_TXT_LANGUAGE, 17, 25, 52, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 57, 23, 171, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -129,6 +129,8 @@ BEGIN
|
|||
GROUPBOX "Interfaz del Usuario", 201, 6, 12, 235, 30
|
||||
LTEXT "Idioma:", ID_TXT_LANGUAGE, 17, 25, 52, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 45, 23, 183, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -131,6 +131,8 @@ BEGIN
|
|||
GROUPBOX "Käyttöliittymä", 201, 6, 12, 235, 30
|
||||
LTEXT "Kieli:", ID_TXT_LANGUAGE, 17, 25, 36, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 37, 23, 191, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -129,6 +129,8 @@ BEGIN
|
|||
GROUPBOX "L'interface utilisateur", 201, 6, 12, 235, 30
|
||||
LTEXT "Langue:", ID_TXT_LANGUAGE, 17, 25, 52, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 47, 23, 181, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -129,6 +129,8 @@ BEGIN
|
|||
GROUPBOX "Superficie di Lavoro", 201, 6, 12, 235, 30
|
||||
LTEXT "Idioma:", ID_TXT_LANGUAGE, 17, 25, 52, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 43, 23, 185, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -132,6 +132,8 @@ BEGIN
|
|||
GROUPBOX "ユーザーインターフェイス", 201, 6, 12, 235, 30
|
||||
LTEXT "言語:", ID_TXT_LANGUAGE, 17, 25, 52, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 39, 23, 189, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -129,6 +129,8 @@ BEGIN
|
|||
GROUPBOX "Gebruikersinterface", 201, 6, 12, 235, 30
|
||||
LTEXT "Taal:", ID_TXT_LANGUAGE, 17, 25, 52, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 37, 23, 191, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -130,6 +130,8 @@ BEGIN
|
|||
GROUPBOX "Brukergrensesnitt", 201, 6, 12, 235, 30
|
||||
LTEXT "Språk:", ID_TXT_LANGUAGE, 17, 25, 23, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 42, 23, 186, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -131,6 +131,8 @@ BEGIN
|
|||
GROUPBOX "Interfejs Użytkownika", 201, 6, 12, 235, 30
|
||||
LTEXT "Język:", ID_TXT_LANGUAGE, 17, 25, 52, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 42, 23, 186, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -129,6 +129,8 @@ BEGIN
|
|||
GROUPBOX "Interface do Usuário", 201, 6, 12, 235, 30
|
||||
LTEXT "Idioma:", ID_TXT_LANGUAGE, 17, 25, 52, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 57, 23, 171, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Inicialização", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Executar ao iniciar o Windows", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -131,6 +131,8 @@ BEGIN
|
|||
GROUPBOX "Интерфейс пользователя", 201, 6, 12, 235, 30
|
||||
LTEXT "Язык:", ID_TXT_LANGUAGE, 17, 25, 23, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 42, 23, 186, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -129,6 +129,8 @@ BEGIN
|
|||
GROUPBOX "Användargränssnitt", 201, 6, 12, 235, 30
|
||||
LTEXT "Språk:", ID_TXT_LANGUAGE, 17, 25, 52, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 42, 23, 186, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -131,6 +131,8 @@ BEGIN
|
|||
GROUPBOX "Kullanıcı Arayüzü", 201, 6, 12, 235, 30
|
||||
LTEXT "Dil:", ID_TXT_LANGUAGE, 17, 25, 52, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 31, 23, 197, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -129,6 +129,8 @@ BEGIN
|
|||
GROUPBOX "Інтерфейс користувача", 201, 6, 12, 235, 30
|
||||
LTEXT "Мова:", ID_TXT_LANGUAGE, 17, 25, 23, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 42, 23, 186, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
|
@ -131,6 +131,8 @@ BEGIN
|
|||
GROUPBOX "使用者介面", 201, 6, 12, 235, 30
|
||||
LTEXT "語言:", ID_TXT_LANGUAGE, 17, 25, 52, 12
|
||||
COMBOBOX ID_CMB_LANGUAGE, 40, 23, 188, 400, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||
AUTOCHECKBOX "Launch on Windows startup", ID_CHK_STARTUP, 17, 59, 200, 12
|
||||
END
|
||||
|
||||
/* About Dialog */
|
||||
|
|
Loading…
Reference in New Issue