Login Page - Create Account

Support Board


Date/Time: Wed, 26 Feb 2020 00:00:51 +0000



[Programming Help] - can no longer find sierra chart windows through GetNextWindow

[2020-01-23 13:03:51]
User735389 - Posts: 146 | Ending Date: 2020-03-16
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
[2020-01-23 13:42:40]
User735389 - Posts: 146 | Ending Date: 2020-03-16
I've gone up to version 2020 and my function still works. I can't seem to download higher version of SC at the moment
[2020-01-24 00:00:22]
Sierra_Chart_Engineering - Posts: 534 | Ending Date: 2020-11-26
We do not know what the issue is. We are not aware of any changes impacting this.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. If possible please keep your questions brief and to the point. Please be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation
[2020-01-24 01:46:55]
User735389 - Posts: 146 | Ending Date: 2020-03-16
I have a couple more data points that can hopefully pinpoint the source of the issue. The specific version this issue first comes up is 2029. The problem seems a bit random, almost like as its iterating through the windows, something happens to crash GetWindowText(). Were there any changes that is any way related to windows or gui objects that GetWindowText would iterate through? changing z-order? thanks

To post a message in this thread, you need to login with your Sierra Chart account:

Login

Login Page - Create Account