提交记录修改Core/Librarys/Win32API.cs+9 −2看文件
| @@ -10,6 +10,8 @@ namespace Core.Librarys | ||
| 10 | 10 | { |
| 11 | 11 | public static class Win32API |
| 12 | 12 | { |
| 13 | 新增: [DllImport("user32.dll")] | |
| 14 | 新增: public static extern IntPtr GetForegroundWindow(); | |
| 13 | 15 | public delegate void WinEventDelegate(IntPtr hWinEventHook, uint eventType, |
| 14 | 16 | IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime); |
| 15 | 17 | [DllImport("user32.dll")] |
| @@ -25,6 +27,8 @@ namespace Core.Librarys | ||
| 25 | 27 | |
| 26 | 28 | [DllImport("psapi.dll", SetLastError = true)] |
| 27 | 29 | public static extern int GetModuleFileNameExA(IntPtr hProcess, IntPtr hModule, StringBuilder lpFilename, int nSize); |
| 30 | 新增: //[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] | |
| 31 | 新增: //static extern bool QueryFullProcessImageName(IntPtr hProcess, uint dwFlags, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder lpExeName, ref uint lpdwSize); | |
| 28 | 32 | |
| 29 | 33 | [DllImport("kernel32.dll", SetLastError = true)] |
| 30 | 34 | public static extern IntPtr OpenProcess(uint dwDesiredAccess, bool bInheritHandle, int dwProcessId); |
| @@ -49,7 +53,7 @@ namespace Core.Librarys | ||
| 49 | 53 | |
| 50 | 54 | |
| 51 | 55 | |
| 52 | 删除: [DllImport("kernel32.dll", SetLastError = true)] | |
| 56 | 新增: [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] | |
| 53 | 57 | public static extern bool QueryFullProcessImageName([In] IntPtr hProcess, [In] int dwFlags, [Out] StringBuilder lpExeName, ref int lpdwSize); |
| 54 | 58 | |
| 55 | 59 | |
| @@ -74,7 +78,10 @@ namespace Core.Librarys | ||
| 74 | 78 | EnumChildWindows(hWnd, lpEnumFunc, pWindowinfo); |
| 75 | 79 | |
| 76 | 80 | windowinfo = (WINDOWINFO)Marshal.PtrToStructure(pWindowinfo, typeof(WINDOWINFO)); |
| 77 | 删除: | |
| 81 | 新增: if (windowinfo.childpid == windowinfo.ownerpid) | |
| 82 | 新增: { | |
| 83 | 新增: return null; | |
| 84 | 新增: } | |
| 78 | 85 | IntPtr proc; |
| 79 | 86 | if ((proc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, (int)windowinfo.childpid)) == IntPtr.Zero) return null; |
| 80 | 87 | |

