Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 580075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:26:03+00:00 2026-05-13T14:26:03+00:00

The documentation for AppActivate(ProcessID) states… The AppActivate function changes the focus to the named

  • 0

The documentation for AppActivate(ProcessID) states…

The AppActivate function changes the
focus to the named application or
window but does not affect whether it
is maximized or minimized.

Unfortunately, it doesn’t then advise how you CAN un-Minimize an application from the task bar when you want it activated.

I can’t find something like a SetWindowState on the Process object, so given I have a ProcessID and/or a Process object, what can be done to bring the window into a Normal or Maximized state?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:26:03+00:00Added an answer on May 13, 2026 at 2:26 pm

    For unknown reasons, it appears that the Process.MainWindowHandle value returned from a VB6 application is not the appropriate value to pass to ShowWindow in order to restore the application from a minimized state.

    In the situation where the application caption is not constant, the FindWindow API call is not useful. This code below provides a function that will return the handle to a running application based on the window’s caption STARTING with a specified value.

    Sample usage : Identifying the IDs…

    Dim hwnd As Integer
    Dim iProcessID As Integer
    
    iProcessID = Shell("SampleApp.exe", AppWinStyle.NormalFocus)
    hwnd = API.GetFirstWindowhandle("Sample App")
    

    … restoring the application…

    AppActivate(iProcessID)
    
    If API.IsMinimized(hwnd) Then
       API.ShowWindow(hwnd)
    End If
    

    … the functional routines …

    Imports System.Runtime.InteropServices
    
    Public Class API
    
       Private Declare Function apiGetTopWindow Lib "user32" Alias "GetTopWindow" (ByVal hwnd As Integer) As Integer
       Private Declare Function apiGetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Integer
       Private Declare Function apiGetWindow Lib "user32" Alias "GetWindow" (ByVal hwnd As Integer, ByVal wCmd As Integer) As Integer
       Private Declare Function apiGetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Integer) As Integer
       Private Declare Function apiGetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer
       Private Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As IntPtr, ByVal nCmdShow As Integer) As Integer
       Private Declare Function apiIsIconic Lib "user32" Alias "IsIconic" (ByVal hwnd As IntPtr) As Boolean
    
       Private Const GW_HWNDNEXT As Integer = 2
       Private Const SW_NORMAL As Integer = 1
    
       Public Shared Function GetFirstWindowHandle(ByVal sStartingWith As String) As Integer
    
          Dim hwnd As Integer
          Dim sWindowName As String
    
          Dim iHandle As Integer = 0
    
          hwnd = apiGetTopWindow(apiGetDesktopWindow)
    
          Do While hwnd <> 0
             sWindowName = zGetWindowName(hwnd)
             If sWindowName.StartsWith(sStartingWith) Then
                iHandle = hwnd
                Exit Do
             End If
             hwnd = apiGetWindow(hwnd, GW_HWNDNEXT)
          Loop
    
          Return iHandle
    
       End Function
    
       Public Shared Function IsMinimized(ByVal hwnd As Integer) As Boolean
    
          Dim ip As New IntPtr(hwnd)
    
          Return apiIsIconic(ip)
    
       End Function
    
       Public Shared Sub ShowWindow(ByVal hwnd As Integer)
    
          Dim ip As New IntPtr(hwnd)
    
          apiShowWindow(ip, SW_NORMAL)
    
       End Sub
    
       Private Shared Function zGetWindowName(ByVal hWnd As Integer) As String
    
          Dim nBufferLength As Integer
          Dim nTextLength As Integer
          Dim sName As String
    
          nBufferLength = apiGetWindowTextLength(hWnd) + 4
          sName = New String(" "c, nBufferLength)
    
          nTextLength = apiGetWindowText(hWnd, sName, nBufferLength)
          sName = sName.Substring(0, nTextLength) 
    
          Return sName
    
       End Function
    
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 302k
  • Answers 302k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Figured out the problem. Turned out to be an issue… May 13, 2026 at 8:20 pm
  • Editorial Team
    Editorial Team added an answer You don't state what data access machinary you are using… May 13, 2026 at 8:20 pm
  • Editorial Team
    Editorial Team added an answer There's no reason you shouldn't use inline HTML tags in… May 13, 2026 at 8:20 pm

Related Questions

The documentation for the round() function states that you pass it a number, and
The documentation for +[NSThread detachNewThreadSelector:toTarget:withObject:] says: For non garbage-collected applications, the method aSelector is
The documentation for Sort says that Sort will throw an ArgumentException if The implementation
The documentation for -hash says it must not change while a mutable object is
The documentation for ant's task states: The performance of the depend task is dependent

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.