[Mwinapi-commits] SF.net SVN: mwinapi:[144] trunk/ManagedWinapi/Windows/SystemWindow.cs
Status: Beta
Brought to you by:
schierlm
From: <zi...@us...> - 2017-12-12 11:41:42
|
Revision: 144 http://sourceforge.net/p/mwinapi/code/144 Author: ziewer Date: 2017-12-12 11:41:40 +0000 (Tue, 12 Dec 2017) Log Message: ----------- Error handling: Catch exception inside ClassName Modified Paths: -------------- trunk/ManagedWinapi/Windows/SystemWindow.cs Modified: trunk/ManagedWinapi/Windows/SystemWindow.cs =================================================================== --- trunk/ManagedWinapi/Windows/SystemWindow.cs 2017-12-12 11:38:03 UTC (rev 143) +++ trunk/ManagedWinapi/Windows/SystemWindow.cs 2017-12-12 11:41:40 UTC (rev 144) @@ -543,17 +543,21 @@ { get { - int length = 64; - while (true) + try { - StringBuilder sb = new StringBuilder(length); - ApiHelper.FailIfZero(GetClassName(_hwnd, sb, sb.Capacity)); - if (sb.Length != length - 1) + int length = 64; + while (true) { - return sb.ToString(); + StringBuilder sb = new StringBuilder(length); + ApiHelper.FailIfZero(GetClassName(_hwnd, sb, sb.Capacity)); + if (sb.Length != length - 1) + { + return sb.ToString(); + } + length *= 2; } - length *= 2; } + catch { return null; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |