config number for status dialog is now stored as property

pull/1/head
Heiko Hund 2009-02-05 14:22:57 +00:00
parent ac6c155243
commit b8f520be05
11 changed files with 17 additions and 22 deletions

View File

@ -86,7 +86,6 @@ BEGIN
PUSHBUTTON "Trennen", ID_DISCONNECT, 50, 190, 50, 14
PUSHBUTTON "Neu Verbinden", ID_RESTART, 150, 190, 50, 14
PUSHBUTTON "Minimieren", ID_HIDE, 100, 190, 50, 14
LTEXT "", ID_TXT_CONFIG, 0, 0, 0, 0
END
/* Change Passphrase Dialog */

View File

@ -81,7 +81,6 @@ BEGIN
PUSHBUTTON "Disconnect", ID_DISCONNECT, 50, 190, 50, 14
PUSHBUTTON "Reconnect", ID_RESTART, 150, 190, 50, 14
PUSHBUTTON "Hide", ID_HIDE, 100, 190, 50, 14
LTEXT "", ID_TXT_CONFIG, 0, 0, 0, 0
END
/* Change Passphrase Dialog */

View File

@ -80,7 +80,6 @@ BEGIN
PUSHBUTTON "Desconectar", ID_DISCONNECT, 50, 190, 50, 14
PUSHBUTTON "Reconectar", ID_RESTART, 150, 190, 50, 14
PUSHBUTTON "Ocultar", ID_HIDE, 100, 190, 50, 14
LTEXT "", ID_TXT_CONFIG, 0, 0, 0, 0
END
/* Change Passphrase Dialog */

View File

@ -79,7 +79,6 @@ BEGIN
PUSHBUTTON "Déconnecter", ID_DISCONNECT, 50, 190, 50, 14
PUSHBUTTON "Reconnecter", ID_RESTART, 150, 190, 50, 14
PUSHBUTTON "Fermer", ID_HIDE, 100, 190, 50, 14
LTEXT "", ID_TXT_CONFIG, 0, 0, 0, 0
END
/* Change Passphrase Dialog */

View File

@ -79,7 +79,6 @@ BEGIN
PUSHBUTTON "Disconnetti", ID_DISCONNECT, 50, 190, 50, 14
PUSHBUTTON "Riconnetti", ID_RESTART, 150, 190, 50, 14
PUSHBUTTON "Nascondi", ID_HIDE, 100, 190, 50, 14
LTEXT "", ID_TXT_CONFIG, 0, 0, 0, 0
END
/* Change Passphrase Dialog */

View File

@ -79,7 +79,6 @@ BEGIN
PUSHBUTTON "Verbroken", ID_DISCONNECT, 50, 190, 50, 14
PUSHBUTTON "Opnieuw verbinden", ID_RESTART, 150, 190, 50, 14
PUSHBUTTON "Verbergen", ID_HIDE, 100, 190, 50, 14
LTEXT "", ID_TXT_CONFIG, 0, 0, 0, 0
END
/* Change Passphrase Dialog */

View File

@ -84,7 +84,6 @@ BEGIN
PUSHBUTTON "Koble fra", ID_DISCONNECT, 50, 190, 50, 14
PUSHBUTTON "Koble til på nytt", ID_RESTART, 150, 190, 40, 14
PUSHBUTTON "Skjul", ID_HIDE, 100, 190, 40, 14
LTEXT "", ID_TXT_CONFIG, 0, 0, 0, 0
END
/* Change Passphrase Dialog */

View File

@ -80,7 +80,6 @@ BEGIN
PUSHBUTTON "Desconectar", ID_DISCONNECT, 50, 190, 50, 14
PUSHBUTTON "Reconectar", ID_RESTART, 150, 190, 50, 14
PUSHBUTTON "Ocultar", ID_HIDE, 100, 190, 50, 14
LTEXT "", ID_TXT_CONFIG, 0, 0, 0, 0
END
/* Change Passphrase Dialog */

View File

@ -85,7 +85,6 @@ BEGIN
PUSHBUTTON "Koppla ner", ID_DISCONNECT, 50, 190, 50, 14
PUSHBUTTON "Återanslut", ID_RESTART, 150, 190, 40, 14
PUSHBUTTON "Göm", ID_HIDE, 100, 190, 40, 14
LTEXT "", ID_TXT_CONFIG, 0, 0, 0, 0
END
/* Change Passphrase Dialog */

View File

@ -42,11 +42,6 @@
#define ID_DISCONNECT 163
#define ID_RESTART 164
#define ID_HIDE 165
/* A hidden textbox used to pass the config nr so dialog knows
* which connection to cancel. If anyone knows of another way
* to pass a variable to dialog, please let me know.
*/
#define ID_TXT_CONFIG 166
/* Change Passphrase Dialog */
#define ID_DLG_CHGPASS 170

View File

@ -25,6 +25,7 @@
#include <windows.h>
#include <tchar.h>
#include <stdlib.h>
#include <stdio.h>
#include <process.h>
@ -436,11 +437,11 @@ void StopAllOpenVPN()
BOOL CALLBACK StatusDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
BOOL Translated;
static const TCHAR cfgProp[] = _T("config");
HWND hwndLogWindow;
RECT rect;
CHARFORMAT charformat;
int config;
UINT config;
switch (msg) {
@ -448,6 +449,9 @@ BOOL CALLBACK StatusDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
/* Set Window Icon "DisConnected" */
SetStatusWinIcon(hwndDlg, ID_ICO_CONNECTING);
/* Set config number for this dialog */
SetProp(hwndDlg, cfgProp, (HANDLE) lParam);
/* Create LogWindow */
hwndLogWindow = CreateWindowEx (0, RICHEDIT_CLASS, NULL,
WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | \
@ -506,7 +510,7 @@ BOOL CALLBACK StatusDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
return TRUE;
case WM_COMMAND:
config=GetDlgItemInt(hwndDlg, ID_TXT_CONFIG, &Translated, FALSE);
config = (UINT) GetProp(hwndDlg, cfgProp);
switch (LOWORD(wParam)) {
case ID_DISCONNECT:
@ -515,7 +519,7 @@ BOOL CALLBACK StatusDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
return TRUE;
case ID_HIDE:
if (o.cnn[GetDlgItemInt(hwndDlg, ID_TXT_CONFIG, &Translated, FALSE)].connect_status != DISCONNECTED)
if (o.cnn[config].connect_status != DISCONNECTED)
{
ShowWindow(hwndDlg, SW_HIDE);
}
@ -524,6 +528,7 @@ BOOL CALLBACK StatusDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
DestroyWindow(hwndDlg);
}
return TRUE;
case ID_RESTART:
SetFocus(GetDlgItem(o.cnn[config].hwndStatus, ID_EDT_LOG));
o.cnn[config].restart = true;
@ -535,14 +540,15 @@ BOOL CALLBACK StatusDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case WM_SHOWWINDOW:
if (wParam == TRUE)
{
config=GetDlgItemInt(hwndDlg, ID_TXT_CONFIG, &Translated, FALSE);
config = (UINT) GetProp(hwndDlg, cfgProp);
if (o.cnn[config].hwndStatus)
SetFocus(GetDlgItem(o.cnn[config].hwndStatus, ID_EDT_LOG));
}
return FALSE;
case WM_CLOSE:
if (o.cnn[GetDlgItemInt(hwndDlg, ID_TXT_CONFIG, &Translated, FALSE)].connect_status != DISCONNECTED)
config = (UINT) GetProp(hwndDlg, cfgProp);
if (o.cnn[config].connect_status != DISCONNECTED)
{
ShowWindow(hwndDlg, SW_HIDE);
}
@ -552,6 +558,10 @@ BOOL CALLBACK StatusDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
return TRUE;
case WM_NCDESTROY:
RemoveProp(hwndDlg, cfgProp);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
@ -909,12 +919,11 @@ void ThreadOpenVPNStatus(int config)
else
{
/* Create and Show Status Dialog */
o.cnn[config].hwndStatus = CreateLocalizedDialog(ID_DLG_STATUS, StatusDialogFunc);
o.cnn[config].hwndStatus = CreateLocalizedDialogParam(ID_DLG_STATUS, StatusDialogFunc, config);
if (!o.cnn[config].hwndStatus)
ExitThread(1);
/* UserInfo: Connecting */
SetDlgItemText(o.cnn[config].hwndStatus, ID_TXT_STATUS, LoadLocalizedString(IDS_NFO_STATE_CONNECTING));
SetDlgItemInt(o.cnn[config].hwndStatus, ID_TXT_CONFIG, (UINT)config, FALSE);
SetWindowText(o.cnn[config].hwndStatus, LoadLocalizedString(IDS_NFO_CONNECTION_XXX, conn_name));
if (o.silent_connection[0]=='0')