Click to See Complete Forum and Search --> : hiding other programs
HexMaster
Nov 27th, 1999, 03:10 AM
I wanna be able to hide a program that is running on my desktop. It doesnt have a title bar and it always stays on top of all other running programs. I dont know what other information someone might need to help me. Please anyone respond with any questions or help (preferably help :-)).
Thanks,
Matt
Compwiz
Nov 27th, 1999, 03:21 AM
You need to know it's Caption, or it's ClassName, then you can use the PostMessage API.
------------------
Tom Young, 14 Year Old
tyoung@stny.rr.com
ICQ: 15743470 (http://wwp.icq.com/15743470) Add Me (http://wwp.icq.com/scripts/search.dll?to=15743470) ICQ Me (http://wwp.icq.com/scripts/contact.dll?msgto=15743470)
AIM: TomY10 (http://www.aol.com/aim/aim30.html)
PERL, JavaScript and VB Programmer
HexMaster
Nov 27th, 1999, 03:42 AM
wow thanx for the quick response! and i found out the caption, but the only place ive been able to find anything related the PostMessage API is closing programs. I dont wanna close this program just make it so i can see it. Can you please show me how to do this?
Matt
Compwiz
Nov 27th, 1999, 09:31 PM
Sorry, for the long response this time... but in this case, you will want to use the ShowWindow API:
Public Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Public Const SW_HIDE = 0
Public Const SW_SHOWNORMAL = 1
Public Sub HideWindow(ByVal hWnd As Long)
Call ShowWindow(hWnd, SW_HIDE)
End Sub
Public Sub ShowWindow(ByVal hWnd As Long)
Call ShowWindow(hWnd, SW_SHOWNORMAL)
End Sub
To get the hWnd, use the FindWindow API:
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
MyhWnd = FindWindow(vbNullString, "Calculator")
------------------
Tom Young, 14 Year Old
tyoung@stny.rr.com
ICQ: 15743470 (http://wwp.icq.com/15743470) Add Me (http://wwp.icq.com/scripts/search.dll?to=15743470) ICQ Me (http://wwp.icq.com/scripts/contact.dll?msgto=15743470)
AIM: TomY10 (http://www.aol.com/aim/aim30.html)
PERL, JavaScript and VB Programmer
[This message has been edited by Compwiz (edited 11-28-1999).]
HexMaster
Nov 28th, 1999, 02:31 AM
wow like thank you that works like perfect for a large part, but i am having yet another problem. I got a program that would give me the like classname of the windows i want to hide the only problem is that there are four of them and they all have the same class name but when i use what you gave me on them it only hides one of them. I dont mean to ask so many questions but im new to this sorta thing. Can you please show me how i would get it to hide all of them? I would like be way thankful.
Matt
Serge
Nov 28th, 1999, 05:44 PM
You can use FindWindowEx API to find all windows with the same class name.
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Public Const SW_HIDE = 0
Public Const SW_SHOWNORMAL = 1
'------Use this on any event you want
Dim lCalculator As Long
lCalculator = FindWindowEx(0, 0, "SciCalc", VbNullString)
Do Until lCalculator = 0
ShowWindow lCalculator, SW_HIDE
lCalculator = FindWindowEx(0, lCalculator, "SciCalc", VbNullString)
Loop
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
HexMaster
Nov 28th, 1999, 06:21 PM
Hey thanks you two you really helped me out alot.
Matt
[This message has been edited by HexMaster (edited 11-29-1999).]
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.