mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 21:15:38 +02:00
fix crash calling GetWindowTextLength()
This commit is contained in:
parent
c719aee32f
commit
c15ab870ac
1 changed files with 15 additions and 8 deletions
|
@ -1203,6 +1203,8 @@ namespace PersistentWindows.Common
|
||||||
if (use_cache && windowTitle.ContainsKey(hwnd))
|
if (use_cache && windowTitle.ContainsKey(hwnd))
|
||||||
return windowTitle[hwnd];
|
return windowTitle[hwnd];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
var length = User32.GetWindowTextLength(hwnd);
|
var length = User32.GetWindowTextLength(hwnd);
|
||||||
if (length > 0)
|
if (length > 0)
|
||||||
{
|
{
|
||||||
|
@ -1213,6 +1215,11 @@ namespace PersistentWindows.Common
|
||||||
t = t.Trim();
|
t = t.Trim();
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//return hwnd.ToString("X8");
|
//return hwnd.ToString("X8");
|
||||||
return "";
|
return "";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue