diff --git a/source/application.cpp b/source/application.cpp index 46e491c35..464444d0c 100644 --- a/source/application.cpp +++ b/source/application.cpp @@ -1424,31 +1424,6 @@ bool MsgSleep(int aSleepDuration, MessageMode aMode) // external ever explicitly posts a WM_QUIT to our thread's queue: g_script.ExitApp(EXIT_WM_QUIT); continue; // Since ExitApp() won't necessarily exit. - -#ifdef CONFIG_DEBUGGER - default: - static UINT sAttachDebuggerMessage = RegisterWindowMessage(_T("AHK_ATTACH_DEBUGGER")); - if (msg.message == sAttachDebuggerMessage && !g_Debugger.IsConnected()) - { - char dbg_host[16] = "localhost"; // IPv4 max string len - char dbg_port[6] = "9000"; - - if (msg.wParam) - { // Convert 32-bit address to string for Debugger::Connect(). - in_addr addr; - addr.S_un.S_addr = (ULONG)msg.wParam; - char *tmp = inet_ntoa(addr); - if (tmp) - strcpy(dbg_host, tmp); - } - if (msg.lParam) - // Convert 16-bit port number to string for Debugger::Connect(). - _itoa(LOWORD(msg.lParam), dbg_port, 10); - - if (g_Debugger.Connect(dbg_host, dbg_port) == DEBUGGER_E_OK) - g_Debugger.ProcessCommands(); - } -#endif } // switch() break_out_of_main_switch: diff --git a/source/script2.cpp b/source/script2.cpp index 5e9778f8a..a0579bc70 100644 --- a/source/script2.cpp +++ b/source/script2.cpp @@ -5513,6 +5513,30 @@ LRESULT CALLBACK MainWindowProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lPar g_script.UpdateTrayIcon(true); // Force the icon into the correct pause, suspend, or mIconFrozen state. // And now pass this iMsg on to DefWindowProc() in case it does anything with it. } + +#ifdef CONFIG_DEBUGGER + static UINT sAttachDebuggerMessage = RegisterWindowMessage(_T("AHK_ATTACH_DEBUGGER")); + if (iMsg == sAttachDebuggerMessage && !g_Debugger.IsConnected()) + { + char dbg_host[16] = "localhost"; // IPv4 max string len + char dbg_port[6] = "9000"; + + if (wParam) + { // Convert 32-bit address to string for Debugger::Connect(). + in_addr addr; + addr.S_un.S_addr = (ULONG)wParam; + char *tmp = inet_ntoa(addr); + if (tmp) + strcpy(dbg_host, tmp); + } + if (lParam) + // Convert 16-bit port number to string for Debugger::Connect(). + _itoa(LOWORD(lParam), dbg_port, 10); + + if (g_Debugger.Connect(dbg_host, dbg_port) == DEBUGGER_E_OK) + g_Debugger.ProcessCommands(); + } +#endif } // switch()