W2K and up support GetConsoleWindow().
Private Declare Function GetConsoleWindow Lib "kernel32" () As Long
otherwise, you'd need to take the tortuous path.
This is the property from the Console Module I use...
of course... you could just use the module in a small program to change the system menu...
Some of the variables are member variables and the API's need to be declared as well. I'd visit the url given in the comments.
' 124103 - HOWTO: Obtain a Console Window Handle (HWND)
' http://support.microsoft.com/default.aspx?scid=KB;en-us;q124103
Dim os As OSVERSIONINFO
Dim Title As String
Dim Unique As String
Dim nRet As Long
' Returned cached value, if possible.
If m_hWnd = 0 Then
' Determine what operating system this is.
os.dwOSVersionInfoSize = Len(os)
Call GetVersionEx(os)
If os.dwPlatformId = VER_PLATFORM_WIN32_NT _
And os.dwMajorVersion >= 5 Then
' This is Windows2000 or later!
m_hWnd = GetConsoleWindow()
Else ' Take the tortuous path...
' Cache the associated title.
Title = Space$(1024)
nRet = GetConsoleTitle(Title, Len(Title))
If nRet Then
Title = Left$(Title, nRet)
End If
' Construct unique string to use as new title.
Unique = Format$(Now, "yyyymmddhhnnss") & Hex$(GetCurrentProcessId())
' Set new title to use for search.
If SetConsoleTitle(Unique) Then
' Find window most likely to be our console.
m_hWnd = FindConsole(Unique)
' Restore original title.
Call SetConsoleTitle(Title)
End If
End If
End If
hWnd = m_hWnd