|
-
Jan 5th, 2001, 10:38 AM
#1
Thread Starter
Addicted Member
Morning,
What api calls should I use for this problem.
When users runs my *.exe I would like to see if the windows exployer is open. If windows exployer is open I would then like to exit it, and or minimize it.
Thanks.
-
Jan 5th, 2001, 10:57 AM
#2
By 'Explorer' do you mean any folder that's open? If that's the case, then simply do a global hWnd search for any window of the CabinetWClass; if any is found than exit.
Code:
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
Private Sub Form_Load()
If FindWindowEx(0, 0, "CabinetWClass", vbNullString) <> 0 Then Unload Me
End Sub
-
Jan 5th, 2001, 11:25 AM
#3
Thread Starter
Addicted Member
Megatron,
For somereason it is not closing windows explorer. I am on a win 95 machine right now. Does this have anything to do w. it?
THe program does not error either. Just sits there 
[Edited by help on 01-05-2001 at 11:39 AM]
-
Jan 5th, 2001, 12:53 PM
#4
Thread Starter
Addicted Member
I still cant get the above api call to work.
However I can use this one as well.
Only down fall is that I have the know the
exact path.
After I find the window How can I close it.
My code so far
Code:
Public Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Code:
Private Sub cmdFind_Click()
Dim hWnd As Long
Dim retval As Long
hWnd = FindWindow(vbNullString, "exploring - (C:)")
If hWnd <> 0 Then MsgBox "Found"
end sub
Now instead of messanging me that its found how do i close it 
THanks
-
Jan 5th, 2001, 02:20 PM
#5
Thread Starter
Addicted Member
Never mind I found out how to do it.
Code:
Dim hwnd As Long
hwnd = FindWindowEx(0, 0, "exploreWClass", vbNullString)
If hwnd <> 0 Then SendMessage hwnd, WM_CLOSE, 0, 0
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
|