|
-
Jan 24th, 2005, 05:11 PM
#1
Thread Starter
Fanatic Member
minimize non- vbapp
What's the best way to minimize a non-vb application?
-
Jan 24th, 2005, 05:19 PM
#2
Re: minimize non- vbapp
You have to use APIs to get the other apps window handle and then send to
message to minimize. Lookup FindWindow and SemdMessage APIs.
When working with APIs its best to download the API Guide and API Viewer from allapi.net.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 24th, 2005, 07:44 PM
#3
Re: minimize non- vbapp
How about doing this?
VB Code:
Option Explicit
Private Declare Function ShowWindow Lib "user32" ( _
ByVal hwnd As Long, _
ByVal nCmdShow As Long _
) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String _
) As Long
Private Const SW_HIDE = 0
Private Const SW_MINIMIZE = 6
Private Sub Command1_Click()
Dim hWndApp As Long
Dim strCaption As String
Dim strProgram As String
strProgram = "notepad.exe"
strCaption = "Untitled - Notepad"
'see if program is already running
hWndApp = FindWindow(vbNullString, strCaption)
'if not then start it
If hWndApp = 0 Then
Shell strProgram, vbNormalFocus
While hWndApp = 0
hWndApp = FindWindow(vbNullString, strCaption)
DoEvents
Wend
End If
'mimimize it
MsgBox "Press OK to minimize"
ShowWindow hWndApp, SW_MINIMIZE
End Sub
...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|