Login Page - Create Account

Support Board


Date/Time: Sat, 20 Apr 2024 06:30:41 +0000



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

View Count: 610

[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
[2020-01-23 13:42:40]
User735389 - Posts: 188
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: 14017
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. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2020-01-24 01:46:55]
User735389 - Posts: 188
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 log in with your Sierra Chart account:

Login

Login Page - Create Account