Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
Exemplo n.º 5
0
 private static extern int GetPrivateProfileString(string section, string key, string def, out STRINGBUFFER retVal, int size, string filePath);
Exemplo n.º 6
0
 public static extern int GetWindowText(IntPtr hWnd, out STRINGBUFFER text, int nMaxCount);
Exemplo n.º 7
0
 public static extern int GetWindowText(IntPtr hWnd, out STRINGBUFFER ClassName, int nMaxCount);
Exemplo n.º 8
0
 private static extern int GetPrivateProfileString(string section, string key, string def, out STRINGBUFFER retVal, int size, string filePath);