private bool StartEnumWindows(IntPtr p_Handle, int p_Param) { if (!IsWindowVisible(p_Handle) || GetParent(p_Handle.ToInt32()) != 0) { return(true); } int pid = 0; GetWindowThreadProcessId(p_Handle, ref pid); var p = Process.GetProcessById(pid); if (_prohibitedProcess.Any(proc => proc == p.ProcessName.ToLower())) { return(true); } STRINGBUFFER _TitleString = new STRINGBUFFER(); GetWindowText(p_Handle, out _TitleString, 256); if (!string.IsNullOrEmpty(_TitleString.szText)) { _windowList.Add(new WindowInfo { HWD = p_Handle, WindowTitle = $"[{p.ProcessName}]{_TitleString.szText}" }); } return(true); }
private bool NetEnumWindows(IntPtr p_Handle, int p_Param) { if (!IsWindowVisible(p_Handle) || GetParent(p_Handle.ToInt32()) != 0) { return(true); } int pid = 0; GetWindowThreadProcessId(p_Handle, ref pid); var p = Process.GetProcessById(pid); if (_prohibitedProcess.Any(proc => proc == p.ProcessName.ToLower())) { return(true); } STRINGBUFFER _TitleString = new STRINGBUFFER(); GetWindowText(p_Handle, out _TitleString, 256); if (!string.IsNullOrEmpty(_TitleString.szText)) { string fileName = Guid.NewGuid() + ".jpg"; _windowList.Add(new PreviewWindowInfo { HWD = p_Handle, WindowTitle = $"[{p.ProcessName}]{_TitleString.szText}", PreviewWindowImagePath = $"{Path.Combine(_tempImageSavePath, fileName)}" }); CaptureWindow(p_Handle, fileName); } return(true); }
public static extern int GetClassName(IntPtr hWnd, out STRINGBUFFER ClassName, int nMaxCount);
public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, out STRINGBUFFER ClassName);
private static extern int GetPrivateProfileString(string section, string key, string def, out STRINGBUFFER retVal, int size, string filePath);
public static extern int GetWindowText(IntPtr hWnd, out STRINGBUFFER text, int nMaxCount);
public static extern int GetWindowText(IntPtr hWnd, out STRINGBUFFER ClassName, int nMaxCount);
private static extern int GetPrivateProfileString(string section, string key, string def, out STRINGBUFFER retVal, int size, string filePath);