checking in latest Yaulw
This commit is contained in:
@@ -3,7 +3,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using diag = System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using SysIO = System.IO;
|
||||
@@ -328,10 +329,56 @@ namespace Yaulw.Win32
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Short / Long FileName N' Path Conversions
|
||||
|
||||
#endregion
|
||||
|
||||
#region Process / Handle Functionallity
|
||||
|
||||
public static string GetProcessName(IntPtr hWnd)
|
||||
{
|
||||
int currentPid = 0;
|
||||
User32.GetWindowThreadProcessId(hWnd, ref currentPid);
|
||||
|
||||
diag.Process process;
|
||||
try
|
||||
{
|
||||
process = diag.Process.GetProcessById(currentPid);
|
||||
}
|
||||
catch (ArgumentException e)
|
||||
{
|
||||
// This is thrown when Process.GetProcessById cannot find the process
|
||||
throw e;
|
||||
}
|
||||
|
||||
return process.ProcessName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the .Net Process Object that owns the passed in hWnd
|
||||
/// </summary>
|
||||
/// <param name="hWnd">handle to a Window</param>
|
||||
/// <returns>a .Net Process or throws an error</returns>
|
||||
public static diag.Process GetProcessFromHandle(IntPtr hWnd)
|
||||
{
|
||||
try
|
||||
{
|
||||
int currentPid = 0;
|
||||
User32.GetWindowThreadProcessId(hWnd, ref currentPid);
|
||||
|
||||
diag.Process process;
|
||||
process = diag.Process.GetProcessById(currentPid);
|
||||
return process;
|
||||
}
|
||||
catch (ArgumentException e)
|
||||
{
|
||||
// This is thrown when Process.GetProcessById cannot find the process
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Short / Long FileName N' Path Conversions
|
||||
|
||||
/// <summary>
|
||||
/// Converts a LongFileNameNPath (Modern Windows Path) into a ShortFileNPath (Old Dos 8.3)
|
||||
/// ~File Must exist on the system
|
||||
|
||||
Reference in New Issue
Block a user