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.
Printable View
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.
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
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]
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
Now instead of messanging me that its found how do i close it :)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
THanks
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