minimize another application that my application starts

The application I have starts another application.  I want that one to be minimized.

Thanks
sherrick123Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LandyJCommented:
If your called application is a windows form, use

dim frm as New MyForm
frm.WindowState = FormWindowState.Minimized
frm.Show()
0
LandyJCommented:
If it is a console (non-windows form) app, I start my stuff as a Process so I can monitor when it finishes:

Dim pi As ProcessStartInfo = New ProcessStartInfo(sAppPtath, sAppCommandLineParms)
pi.Verb = "open"
pi.WindowStyle = ProcessWindowStyle.Minimized
pi.CreateNoWindow() = True
pi.UseShellExecute = True
Dim p As Process = System.Diagnostics.Process.Start(pi)
Dim i As Integer = 0
For i = 0 To 60 'Give the process 15 seconds to finish
  p.WaitForExit(250)
  If p.HasExited Then
    Exit For
  End If
  'Let the system catch up
  Application.DoEvents()
Next

If i => 60 Then 'Processdidn't complete in time allowed
  msgbox("Error...",vbOkOnly, "Process didn't finish in time")
End If

If you don't need to monitor for completion, don't use the FOR loop

Hope these help,
Landy
0
sherrick123Author Commented:
Here is my routine.  I marked the application that I am starting.

Dim oScanEnumerator As MicroStationDGN.ElementEnumerator
        Dim oScanCriteria As MicroStationDGN.ElementScanCriteria
        Dim oMyMicroStation As New MicroStationDGN.Application   'This is the application I start
        Dim oDesign As MicroStationDGN.DesignFile
        Dim oElement As MicroStationDGN.Element
        Dim oElementRange As MicroStationDGN.Range3d
        Dim omyView As MicroStationDGN.View
        Dim oIsThereAFence As Boolean
        Dim oPDFName As String
        Dim oPrintPath As String
        Dim i As Integer
        Dim oPrintCommand As String



        oIsThereAFence = False

        oScanCriteria = New MicroStationDGN.ElementScanCriteria
        oScanCriteria.ExcludeAllTypes()
        oScanCriteria.ExcludeAllClasses()
        oScanCriteria.IncludeClass(MicroStationDGN.MsdElementClass.msdElementClassConstruction)
        oScanCriteria.IncludeType(MicroStationDGN.MsdElementType.msdElementTypeShape)

        i = InStr(DgnFile.ToString, ".dgn")
        oPDFName = Mid(DgnFile.ToString, 1, i - 1) & ".pdf"
        oPrintPath = cboFiles.SelectedItem.ToString & "\Images\" & oPDFName

        oMyMicroStation.Visible = True


'This is where I am opening the application
        oDesign = oMyMicroStation.OpenDesignFile(DgnFile.FullName.ToString, False, MicroStationDGN.MsdV7Action.msdV7ActionWorkmode)
       
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

LandyJCommented:
It looks like that's going to be a function of the MicroStationDGN object.  I've never worked with it (actually, I had to look up what MicroStation DGN was).  Is there nothing in the documentation?  I couldn't find anything on the web that was useful.  My bluff would be that you might be able to use the .Visible property to do what you need.  But, if not, there might be a .Handle property that you can use to find the window and then you can Minimize the app from there. I've not tried to do that in VB.NET, so I'm sorry, but I can't help you there.

What are you trying to open, btw?  I see you're trying to work with a PDF file, but I don't see what the outcome is.  Are you just trying to print the PDF file using MicroStation?  If so, I've found a great object that prints PDFs silently.  Let me know, I'll post the link to that.

-Landy
0
sherrick123Author Commented:

I am creating a PDF from a MicroStation Design file (CAD File).  The problem I found out when you minimize it and take the focus away from the application the plot process does not work.
Thanks
0
LandyJCommented:
That, unfortunately, sounds like it is a function of the MicroStation component/application.  Not sure why is would monitor focus while it is processing, but evidently it does.

I'm not a CAD expert (or CAD-anything, for that matter, I can spell it, that's about it).  Do you have the ability to produce a SVG (scalable vector graphics) or any other image of your CAD document?  I use this componet, http://www.xmlpdf.com/ibex.html, in an unattended program to embed JPG files of signatures into PDF documents.  It converts XSL:FO doucments into PDF documents.  It's very quick and efficient and relatively easy to implement into a .NET program.  Wrapping a SVG version of your CAD file in an XSL:FO document is not a difficult thing to do.  It might be worth a look, if the non-focus execution is a must.

Sorry I couldn't help more,
Landy
0
sherrick123Author Commented:

I have it working now.  Talked to the vendor and it is Working as Designed
0
LandyJCommented:
Great.  Glad you solved your problem.  You should post the solution, in case someone else has the same issues.

Also, you'll want to request a refund because you answered your own question (Refund/PAQ)
http://www.experts-exchange.com/help.jsp#hi70
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.