I have a form that allows users to open Windows Explorer and view folders based on a list of path names.
I want to create code that will close all or a specific Windows Explorer screen.
I used this line to open the Windows Explorer
Application.FollowHyperlink strPathName, , False, False
How do I close Windows Explorer?
Thanks
2 8813
I have a form that allows users to open Windows Explorer and view folders based on a list of path names.
I want to create code that will close all or a specific Windows Explorer screen.
I used this line to open the Windows Explorer
Application.FollowHyperlink strPathName, , False, False
How do I close Windows Explorer?
Thanks
Hi, jercha.
If you will manage to run WinExplorer via "Shell" function, then the following will be useful for you Close a Program
Hi, jercha.
If you will manage to run WinExplorer via "Shell" function, then the following will be useful for you Close a Program
Your notepad program worked for notepad but not for explorer.
How do I fix?
I replaced notepad with explorer but the CloseProcess failed to close the explorer screen:
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Any) As Long
Public Declare Function GetWindowThreadProcessId Lib "user32" _
(ByVal hWnd As Long, ByRef lpdwProcessId As Long) As Long
Public Declare Function EnumWindows Lib "user32" _
(ByVal fpCallback As Long, ByVal lParam As Long) As Long
Public Const WM_CLOSE = 16
Public Sub RunAndCloseApp()
Dim lngProcID As Long
lngProcID = Shell("explorer")
MsgBox "Explorer started, Ok to close it", vbOKOnly, "Close App"
CloseProcess lngProcID
End Sub
Public Sub clbEnumWindows(ByVal hWnd As Long, ByVal lngParam As Long)
Dim lngProcID As Long
GetWindowThreadProcessId hWnd, lngProcID
If lngProcID = lngParam Then
'Debug.Print hWnd, lngProcID
SendMessage hWnd, WM_CLOSE, 0, 0
End If
End Sub
Public Sub CloseProcess(ByVal lngProcID)
EnumWindows AddressOf clbEnumWindows, lngProcID
End Sub Sign in to post your reply or Sign up for a free account.
Similar topics
by: MAFDoit |
last post by:
NEWSGROUP:
This is a followup to the post below. The original post was helpful and I
now know many ways to RETRIEVE information from Windows explorer, but I
haven't yet found a way to INSERT or...
|
by: Shang Wenbin |
last post by:
Hi,
When I want to close the current window using window.close() in IE6.0,
there will be a confirm box that: The web page you are viewing is trying
to close the window. Do you want to close this...
|
by: Paul Steele |
last post by:
Is there any way to check for open Explorer windows and if any are found,
tell Windows Explorer to close them. I don't want a brute force method of
killing Explorer and letting it restart. I'd...
|
by: Alpha |
last post by:
I have a Window based application that shows up still running in the task
manager when I close it. It reaches the "this.close" statement and then it
stops at the "}" at the section of the...
|
by: Bruce Wiebe |
last post by:
hi all
im having a problem accessing a text file on my hard disk after ive
created it and added some text to it it would appear that the file is
still locked.
What happens is this i have...
|
by: Mike Kober |
last post by:
I'm having difficulty getting this to work. Any help would be appreciated.
What I'm trying to do is to open Explorer onto the Windows/fonts directory
and then close it. I've added a font...
|
by: Toccoa |
last post by:
After considerable googling - I mean searching with Google(r) - I
could not find javascript on a button or <a href=... to close a
window in the latest versions of IE and FireFox.
There seemed...
|
by: John |
last post by:
I am looking for VBA code that will work with Access 2003 to enable
dragging and dropping a file/folder name from Windows XP Explorer into
an Access form's text box. This is a common functionality...
|
by: Mark Gold |
last post by:
Hi! We have a VB application using Crystal Reports 6 that has worked
successfully on hundreds of systems for over 10 years. Now, on one
network, the application and access database does not close....
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |