Results 1 to 4 of 4

Thread: [RESOLVED] How to minimize it ?

  1. #1

    Thread Starter
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Resolved [RESOLVED] How to minimize it ?

    Hi guys

    I'm running a process using the Process class. My question is, how can we minimize the process while it is running ?

    Thanks

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  2. #2

    Thread Starter
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: How to minimize it ?

    I think, I found the solution.

    vb.net Code:
    1. Imports System.Diagnostics
    2.  
    3. Public Class Form1
    4.  
    5. #Region "API Code"
    6.  
    7.     Private Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal nCmdShow As SHOW_WINDOW) As Boolean
    8.  
    9.     <Flags()> _
    10.     Private Enum SHOW_WINDOW As Integer
    11.         SW_HIDE = 0
    12.         SW_SHOWNORMAL = 1
    13.         SW_NORMAL = 1
    14.         SW_SHOWMINIMIZED = 2
    15.         SW_SHOWMAXIMIZED = 3
    16.         SW_MAXIMIZE = 3
    17.         SW_SHOWNOACTIVATE = 4
    18.         SW_SHOW = 5
    19.         SW_MINIMIZE = 6
    20.         SW_SHOWMINNOACTIVE = 7
    21.         SW_SHOWNA = 8
    22.         SW_RESTORE = 9
    23.         SW_SHOWDEFAULT = 10
    24.         SW_FORCEMINIMIZE = 11
    25.         SW_MAX = 11
    26.     End Enum
    27.  
    28. #End Region
    29.  
    30.     '~~~ Variable that holds the Process object
    31.     Dim myProc As Process
    32.  
    33.     '~~~ Start the process
    34.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    35.         myProc = Process.Start("notepad")
    36.     End Sub
    37.  
    38.     '~~~ Minimize the process
    39.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    40.         ShowWindow(myProc.MainWindowHandle, SHOW_WINDOW.SW_MINIMIZE)
    41.     End Sub
    42.  
    43. End Class
    It's using API. But is there any inbuilt functions/subs available for this ?


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to minimize it ?

    API is your only option because all you've got is a window handle, not a .NET Form object.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: How to minimize it ?

    Thanks

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width