Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi everybody.

 

I'm launching an app kinda like this:

 

 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:

  '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?

  • *Experts*
Posted

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.

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...