|
|
@ -4,6 +4,11 @@ |
|
|
|
#include "../Config.h" |
|
|
|
#include "../Config.h" |
|
|
|
#include "resource.h" |
|
|
|
#include "resource.h" |
|
|
|
#include "Win32App.h" |
|
|
|
#include "Win32App.h" |
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(_MSC_VER) && _MSC_VER < 1900 |
|
|
|
|
|
|
|
#define snprintf _snprintf |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#define ID_ABOUT 2000 |
|
|
|
#define ID_ABOUT 2000 |
|
|
|
#define ID_EXIT 2001 |
|
|
|
#define ID_EXIT 2001 |
|
|
@ -98,7 +103,7 @@ namespace win32 |
|
|
|
char buf[30]; |
|
|
|
char buf[30]; |
|
|
|
std::string httpAddr; i2p::config::GetOption("http.address", httpAddr); |
|
|
|
std::string httpAddr; i2p::config::GetOption("http.address", httpAddr); |
|
|
|
uint16_t httpPort; i2p::config::GetOption("http.port", httpPort); |
|
|
|
uint16_t httpPort; i2p::config::GetOption("http.port", httpPort); |
|
|
|
std::snprintf(buf, 30, "http://%s:%d", httpAddr.c_str(), httpPort); |
|
|
|
snprintf(buf, 30, "http://%s:%d", httpAddr.c_str(), httpPort); |
|
|
|
ShellExecute(NULL, "open", buf, NULL, NULL, SW_SHOWNORMAL); |
|
|
|
ShellExecute(NULL, "open", buf, NULL, NULL, SW_SHOWNORMAL); |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
@ -119,6 +124,29 @@ namespace win32 |
|
|
|
ShowWindow(hWnd, SW_HIDE); |
|
|
|
ShowWindow(hWnd, SW_HIDE); |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case SC_CLOSE: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
std::string close; i2p::config::GetOption("close", close); |
|
|
|
|
|
|
|
if (0 == close.compare("ask")) |
|
|
|
|
|
|
|
switch(::MessageBox(hWnd, "Would you like to minimize instead of exiting?" |
|
|
|
|
|
|
|
" You can add 'close' configuration option. Valid values are: ask, minimize, exit.", |
|
|
|
|
|
|
|
"Minimize instead of exiting?", MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON1)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case IDYES: close = "minimize"; break; |
|
|
|
|
|
|
|
case IDNO: close = "exit"; break; |
|
|
|
|
|
|
|
default: return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (0 == close.compare("minimize")) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ShowWindow(hWnd, SW_HIDE); |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (0 != close.compare("exit")) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
::MessageBox(hWnd, close.c_str(), "Unknown close action in config", MB_OK | MB_ICONWARNING); |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
case WM_TRAYICON: |
|
|
|
case WM_TRAYICON: |
|
|
|