Restore or Maximize

JumpsInLava

Regular
Joined
Sep 17, 2003
Messages
55
Hi everybody.

I'm launching an app kinda like this:

Visual Basic:
  Dim duhProcess As Process = New Process
  duhProcess.StartInfo.FileName = "Notepad"
  duhProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
  duhProcess.Start()

Then I'm doing some other stuff kinda like this:
Visual Basic:
   'need sumthin here
  AppActivate(duhProcess.Id)
  SendKeys.SendWait("This is text.")

How do I restore or maximize the other app if it has been minimized?
 
Actually, you'll probably need [api]SetWindowPlacement[/api] if you actually want to change the window state. SetForegroundWindow will just bring it to the front.

There's an example of using the API on the site that you can transfer to .NET easily - just change the Longs in the declaration to Int32s, and the hWnd params to IntPtr.
 
Thank you for the replies.

Well, I found that by using SendKeys I can send a %( R) or a %( X) to restore or maximize which is kind of what SetWindowPlacement does, and that works, but I would prefer to just activate it, and pop it up in its last state, like what happens when you click on an app that is minimized in the task bar.

P.S.
I'm converting my stuff to use SendMessage because of the problems I keep having with SendKeys....If I find something in there, I will post it.
 
Back
Top