|
|
|
@ -972,31 +972,6 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case WM_KEYDOWN: |
|
|
|
|
|
|
|
if (app) { |
|
|
|
|
|
|
|
switch (wParam) { |
|
|
|
|
|
|
|
case VK_TAB: { |
|
|
|
|
|
|
|
HWND hFocus = GetFocus(); |
|
|
|
|
|
|
|
if (hFocus == app->hEditAddr) { |
|
|
|
|
|
|
|
SetFocus(app->hEditPort); |
|
|
|
|
|
|
|
int len = GetWindowTextLengthA(app->hEditPort); |
|
|
|
|
|
|
|
SendMessageA(app->hEditPort, EM_SETSEL, len, len); |
|
|
|
|
|
|
|
} else if (hFocus == app->hEditPort) { |
|
|
|
|
|
|
|
SetFocus(app->hEditAddr); |
|
|
|
|
|
|
|
int len = GetWindowTextLengthA(app->hEditAddr); |
|
|
|
|
|
|
|
SendMessageA(app->hEditAddr, EM_SETSEL, len, len); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case VK_RETURN: |
|
|
|
|
|
|
|
if (!app->isConnected) OnConnect(app); |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
case VK_ESCAPE: |
|
|
|
|
|
|
|
if (app->isConnected) OnDisconnect(app); |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case WM_DESTROY: |
|
|
|
case WM_DESTROY: |
|
|
|
PostQuitMessage(0); |
|
|
|
PostQuitMessage(0); |
|
|
|
@ -1185,6 +1160,31 @@ int etcpmon_gui_run(struct etcpmon_app* app) { |
|
|
|
UpdateWindow(app->hWndMain); |
|
|
|
UpdateWindow(app->hWndMain); |
|
|
|
MSG msg; |
|
|
|
MSG msg; |
|
|
|
while (GetMessageA(&msg, NULL, 0, 0)) { |
|
|
|
while (GetMessageA(&msg, NULL, 0, 0)) { |
|
|
|
|
|
|
|
if (msg.message == WM_KEYDOWN && app) { |
|
|
|
|
|
|
|
HWND hFocus = GetFocus(); |
|
|
|
|
|
|
|
if (hFocus == app->hEditAddr || hFocus == app->hEditPort) { |
|
|
|
|
|
|
|
if (msg.wParam == VK_TAB) { |
|
|
|
|
|
|
|
if (hFocus == app->hEditAddr) { |
|
|
|
|
|
|
|
SetFocus(app->hEditPort); |
|
|
|
|
|
|
|
int len = GetWindowTextLengthA(app->hEditPort); |
|
|
|
|
|
|
|
SendMessageA(app->hEditPort, EM_SETSEL, len, len); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
SetFocus(app->hEditAddr); |
|
|
|
|
|
|
|
int len = GetWindowTextLengthA(app->hEditAddr); |
|
|
|
|
|
|
|
SendMessageA(app->hEditAddr, EM_SETSEL, len, len); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (msg.wParam == VK_RETURN) { |
|
|
|
|
|
|
|
if (!app->isConnected) OnConnect(app); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (msg.wParam == VK_ESCAPE) { |
|
|
|
|
|
|
|
if (app->isConnected) OnDisconnect(app); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
TranslateMessage(&msg); |
|
|
|
TranslateMessage(&msg); |
|
|
|
DispatchMessageA(&msg); |
|
|
|
DispatchMessageA(&msg); |
|
|
|
} |
|
|
|
} |
|
|
|
|