Can the snippet c# to roll(expand) the window of the third-party process with a specific name(the window)?

0 like 0 dislike
36 views
Can the snippet c# to roll(expand) the window of the third-party process with a specific name(the window)?
by | 36 views

1 Answer

0 like 0 dislike
Look here, there is a suspicion that is what you are looking for

[DllImport("user32.dll")] public static extern IntPtr FindWindow(string className, string windowTitle); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool ShowWindow(IntPtr hWnd, ShowWindowEnum flags); [DllImport("user32.dll")] private static extern int SetForegroundWindow(IntPtr hwnd); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool GetWindowPlacement(IntPtr hWnd, ref Windowplacement lpwndpl); private enum ShowWindowEnum { Hide = 0, ShowNormal = 1, ShowMinimized = 2, ShowMaximized = 3, Maximize = 3, ShowNormalNoActivate = 4, Show = 5, Minimize = 6, ShowMinNoActivate = 7, ShowNoActivate = 8, Restore = 9, ShowDefault = 10, ForceMinimized = 11 }; private struct Windowplacement { public int length; public int flags; public int showCmd; public System.Drawing.Point ptMinPosition; public System.Drawing.Point ptMaxPosition; public System.Drawing.Rectangle rcNormalPosition; } private void BringWindowToFront() { WdwIntPtr IntPtr = FindWindow(null, "Put_your_window_title_here"); //get the hWnd of the process Windowplacement placement = new Windowplacement(); GetWindowPlacement(wdwIntPtr, ref placement); // Check if window is minimized if (placement.showCmd == 2) { //the window is hidden so we restore it ShowWindow(wdwIntPtr, ShowWindowEnum.Restore); } //set user focus to the window SetForegroundWindow(wdwIntPtr); }
by

Related questions

0 like 0 dislike
1 answer
asked May 10, 2019 by Xveeder
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
33,673 users