fix crash calling GetWindowTextLength()

This commit is contained in:
Kang Yu 2025-02-04 11:01:30 -08:00
parent c719aee32f
commit c15ab870ac

View file

@ -1203,6 +1203,8 @@ namespace PersistentWindows.Common
if (use_cache && windowTitle.ContainsKey(hwnd))
return windowTitle[hwnd];
try
{
var length = User32.GetWindowTextLength(hwnd);
if (length > 0)
{
@ -1213,6 +1215,11 @@ namespace PersistentWindows.Common
t = t.Trim();
return t;
}
}
catch (Exception e)
{
}
//return hwnd.ToString("X8");
return "";