Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

minimize another application that my application starts

Posted on 2004-11-17
8
Medium Priority
?
351 Views
Last Modified: 2007-11-27
The application I have starts another application.  I want that one to be minimized.

Thanks
0
Comment
Question by:sherrick123
  • 5
  • 3
8 Comments
 
LVL 7

Expert Comment

by:LandyJ
ID: 12609874
If your called application is a windows form, use

dim frm as New MyForm
frm.WindowState = FormWindowState.Minimized
frm.Show()
0
 
LVL 7

Expert Comment

by:LandyJ
ID: 12609927
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
 

Author Comment

by:sherrick123
ID: 12615446
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 7

Expert Comment

by:LandyJ
ID: 12616666
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
 

Author Comment

by:sherrick123
ID: 12619063

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
 
LVL 7

Expert Comment

by:LandyJ
ID: 12620378
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
 

Author Comment

by:sherrick123
ID: 12625504

I have it working now.  Talked to the vendor and it is Working as Designed
0
 
LVL 7

Accepted Solution

by:
LandyJ earned 750 total points
ID: 12625665
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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Integration Management Part 2
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question