Added HWndCounter tool to count/debug window handle usage
Add DSO Framer errors to our error log Commented out a debug console.writeline
This commit is contained in:
parent
cd3d3f15eb
commit
1648de9f8d
@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Volian.Base.Library
|
||||
{
|
||||
@ -223,4 +224,34 @@ namespace Volian.Base.Library
|
||||
#endif
|
||||
}
|
||||
}
|
||||
public static class HWndCounter
|
||||
{
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern IntPtr GetCurrentProcess();
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern uint GetGuiResources(IntPtr hProcess, uint uiFlags);
|
||||
|
||||
private enum ResourceType
|
||||
{
|
||||
Gdi = 0,
|
||||
User = 1
|
||||
}
|
||||
public static void GetWindowHandlesForCurrentProcess(IntPtr hWnd)
|
||||
{
|
||||
GetWindowHandlesForCurrentProcess(hWnd, "");
|
||||
}
|
||||
private static uint lastUserObject = 0;
|
||||
public static void GetWindowHandlesForCurrentProcess(IntPtr hWnd, string str, params object[] objects)
|
||||
{
|
||||
IntPtr processHandle = GetCurrentProcess();
|
||||
uint gdiObjects = GetGuiResources(processHandle, (uint)ResourceType.Gdi);
|
||||
uint userObjects = GetGuiResources(processHandle, (uint)ResourceType.User);
|
||||
if (lastUserObject != userObjects)
|
||||
Console.WriteLine("winhandle count = {0} GDIObjs {1} UserObjs {2} dif {3} {4}", gdiObjects + userObjects, gdiObjects, userObjects,(int)userObjects - (int)lastUserObject, string.Format(str, objects));
|
||||
lastUserObject = userObjects;
|
||||
//return Convert.ToInt32(gdiObjects + userObjects);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -161,9 +161,11 @@ namespace Volian.Controls.Library
|
||||
try
|
||||
{
|
||||
this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName);
|
||||
//this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName,false,"Word.Document","","");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_MyLog.Warn("dso fraimer error", ex); // put exception message in the error log
|
||||
System.IO.FileStream fs = MyDSOFile.MyFile.Create();
|
||||
using (DocumentAuditInfoList dail = DocumentAuditInfoList.Get(MyDocumentInfo.DocID))
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
next = (cbxReverse.Checked) ? next.SearchPrev : next.SearchNext;
|
||||
}
|
||||
if (next != null) Console.WriteLine("next {0} {1}", next.ItemID, next.MyContent.Text);
|
||||
//if (next != null) Console.WriteLine("next {0} {1}", next.ItemID, next.MyContent.Text);
|
||||
if ((next == null) || next.IsSection)
|
||||
{
|
||||
if (!findingbookmarks)
|
||||
|
Loading…
x
Reference in New Issue
Block a user