added more HResult checking for supported APIs per msdn documentation

git-svn-id: svn://svn.code.sf.net/p/processhacker/code@2072 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
dmex04
2009-10-06 16:51:13 +00:00
parent a7b1ca5cdb
commit 629b7cec4e
5 changed files with 11 additions and 6 deletions
+1 -1
View File
@@ -2332,7 +2332,7 @@ namespace ProcessHacker.Native.Api
);
[DllImport("uxtheme.dll", CharSet = CharSet.Unicode)]
public static extern int SetWindowTheme(
public static extern HResult SetWindowTheme(
[In] IntPtr hWnd,
[In] string appName,
[In] string idList
+2 -1
View File
@@ -314,7 +314,8 @@ namespace ProcessHacker.Common
/// <param name="theme">A name of a theme.</param>
public static void SetTheme(this Control control, string theme)
{
Win32.SetWindowTheme(control.Handle, theme, null);
HResult setWindowThemeResult = Win32.SetWindowTheme(control.Handle, theme, null);
setWindowThemeResult.ThrowIf();
}
/// <summary>
@@ -163,7 +163,9 @@ namespace ProcessHacker
{
case 0x1: /*WM_CREATE*/
{
Win32.SetWindowTheme(this.Handle, "explorer", null);
HResult setThemeResult = Win32.SetWindowTheme(this.Handle, "explorer", null);
setThemeResult.ThrowIf();
Win32.SendMessage(this.Handle, (WindowMessage)LVM_SetExtendedListViewStyle, LVS_Ex_DoubleBuffer, LVS_Ex_DoubleBuffer);
break;
}
@@ -41,7 +41,8 @@ public class VistaTreeView : System.Windows.Forms.TreeView
if (OSVersion.IsAboveOrEqual(WindowsVersion.Vista))
{
Win32.SendMessage(this.Handle, (WindowMessage)TVM_SETEXTENDEDSTYLE, 0, TVS_EX_FADEINOUTEXPANDOS);
Win32.SetWindowTheme(this.Handle, "explorer", null);
HResult setThemeResult = Win32.SetWindowTheme(this.Handle, "explorer", null);
setThemeResult.ThrowIf();
}
base.OnHandleCreated(e);
}
@@ -174,7 +174,7 @@ namespace TaskbarLib.Interop
private CALPWSTR calpwstr;
[DllImport("ole32.dll")]
private static extern int PropVariantClear(ref PropVariant pvar);
private static extern HResult PropVariantClear(ref PropVariant pvar);
public VarEnum VarType
{
@@ -202,7 +202,8 @@ namespace TaskbarLib.Interop
public void Clear()
{
PropVariantClear(ref this);
HResult clearResult = PropVariantClear(ref this);
clearResult.ThrowIf();
}
public void Dispose()