|
-
Aug 27th, 2006, 02:47 AM
#1
Thread Starter
Lively Member
[RESOLVED] How Do I Set Focus To A Window (external program) That Is Minimized
How can I bring focus and make the window have a normal state for a program that is minimized. I am trying to bring focus to an external program. Any help would be appreciated. This is what I got
[DllImport("user32.dll")]
public static extern int SetWindowLong(int window, int index, int
value);
[DllImport("user32.dll")]
public static extern int GetWindowLong(int window, int index);
[DllImport("user32.dll")]
public static extern int FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(int hWnd);
public const int GWL_EXSTYLE = -20;
public const int WS_EX_TOOLWINDOW = 0x00000080;
public const int WS_EX_APPWINDOW = 0x00040000;
int hwnd = FindWindow("ConsoleWindowClass", "External window title");
int windowStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
SetWindowLong(hwnd, GWL_EXSTYLE, windowStyle | WS_EX_APPWINDOW);
SetForegroundWindow(hwnd);
but it does not bring the window out of minimized state.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|