Login Page - Create Account

Support Board


Date/Time: Tue, 16 Apr 2024 06:08:53 +0000



Post From: can no longer find sierra chart windows through GetNextWindow

[2020-01-23 13:03:51]
User735389 - Posts: 188
I updated from version 1971 to the latest today and it seems to have broken a function of mines. So what i do is automatically rearrange some windows (main sierra window, floating control bars, detached charts, etc...) by iterating through all the windows, finding a title match to get the hwnd, then set its position. Its worked great up until today. The function still works for non-sierra chart windows. The oddity is GetWindowText() hangs the app. If increased the size of the title string array, it no longer hangs but it can't find the window (its like it skips it, because when i use the same value in 1971, it also skips). here's a code snipped



HWND tempHwnd = FindWindow(NULL, NULL);
wchar_t wchar[2000]; // using a value of, say 30000, no longer hangs, but findwindow doesn't seem to work properly at this point
while (true) {
tempHwnd = GetNextWindow(tempHwnd, GW_HWNDNEXT);
  if (tempHwnd == NULL || tempHwnd == 0) // no more windows, no found
   break;

GetWindowText(tempHwnd, wchar, sizeof(wchar));
_bstr_t wnd_title(wchar);
std::string title = std::string(wnd_title);
if (Help::StringContains(title, titleSubStr1)) { // if window title found
....
}
}




Date Time Of Last Edit: 2020-01-23 13:04:44