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 prefer something a little less
drastic. I suspect what I'm going to need is some API call such as
SendMessage. Anybody have any suggestions? 2 13243
"Paul Steele" <pa*********@ac adiau.ca> wrote in message
news:uo******** ******@TK2MSFTN GP14.phx.gbl... 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 prefer something a little less drastic. I suspect what I'm going to need is some API call such as SendMessage. Anybody have any suggestions?
I found half the answer to my original question. By using a combination of
the Windows API calls FindWindow and SendMessage, it's quite simple to close
an open Exporer window:
int iHandle=Win32.F indWindow("Expl oreWClass" ,windowName);
int j=Win32.SendMes sage(iHandle, Win32.WM_SYSCOM MAND, Win32.SC_CLOSE,
0);
The part I haven't figured out is how to get the name of any open windows in
Explorer. Having just the class name is not enough to get the window
handle. Another API call I suspect...
"Paul Steele" <pa*********@ac adiau.ca> wrote in message
news:O%******** ********@TK2MSF TNGP14.phx.gbl. .. "Paul Steele" <pa*********@ac adiau.ca> wrote in message news:uo******** ******@TK2MSFTN GP14.phx.gbl... 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 prefer something a little less drastic. I suspect what I'm going to need is some API call such as SendMessage. Anybody have any suggestions?
I found half the answer to my original question. By using a combination of the Windows API calls FindWindow and SendMessage, it's quite simple to close an open Exporer window:
int iHandle=Win32.F indWindow("Expl oreWClass" ,windowName); int j=Win32.SendMes sage(iHandle, Win32.WM_SYSCOM MAND, Win32.SC_CLOSE, 0);
The part I haven't figured out is how to get the name of any open windows in Explorer. Having just the class name is not enough to get the window handle. Another API call I suspect...
This code does what I want:
int wHandle;
while ((wHandle = Win32.FindWindo w("ExploreWClas s", null)) > 0)
{
Win32.SendMessa ge(wHandle, Win32.WM_SYSCOM MAND, Win32.SC_CLOSE, 0);
} This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sandy |
last post by:
Hello -
I have a little application that I would like to have an exit button on that
closes my web application and closes Internet Explorer.
What is the code that will do that?
Any help will be greatly appreciated!
--
|
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 programmatically to the directory and
found that the easiest way to refresh the folder is to just open windows
explorer. Without doing this, it isn't refreshed in the system. I had the
same problem in VB6 and VBA as with VB.net. Searching the newsgroups...
|
by: Wendy |
last post by:
Hello,
I have a program that does the following:
When a user clicks on a row in a VB.NET datagrid, it will open a web page in
Internet Explorer (that corresponds to that item in the selected row in the
datagrid). It will automatically print that web page, and then it will close
the Internet Explorer window. I have code that works perfectly when a
regular web page is opened, however when a pdf web page is opened the
printing never...
|
by: shinichi81 |
last post by:
1. I create a background Windows Explorer (by using CreateProcess() function with szCmdline = "explorer.exe /select,C:\" and hidden option).
After that, from Desktop, right click "My Computer" then select "Open". If I close this Windows Explorer, my hidden windows is disappeared.??? (they all have the same class name, "CabinetWClass"). Do you have any idea about this?
2. Is it safe if I do as below:
- Check all windows to find Windows...
|
by: zybernau |
last post by:
hi, all
in javascript
i need to close all the child windows that i have opened through a parent window
scenario:
* here i will be having as many as child window opened and name given to the child window can not be tracked because each will be having a different name, and
* i am using 70 to 80 popup windows through out my page
* there can be any number of child windows opened , at the time of user triGgers the event from...
| |
by: jercha |
last post by:
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?
|
by: =?Utf-8?B?ZGlncmVnYQ==?= |
last post by:
After installing Microsoft Office 2007 + desktop search, Windows explorer
began to give me all kinds of errors including a DR Watson, which I haven't
seen since installing XP.
I found a forum some where on the net that suggested uninstalling Desktop
search which I did. I got Windows explorer to work partially by that I mean
as follows:
1-Restarting the PC allows me to open Explorer once and as soon as I close
the open window I'm not...
|
by: ginge6000 |
last post by:
Hi,
I have an app which creates batch files to transfer stuff around a network. As part of the batch files they disconnect the networked M:\ drive. Unfortunately if a WIndows Explorer/My Computer window is open showing the M:\ drive then the batch file bombs out (can't disconnect network drive while in use) and the VBA gets stuck in an endless loop waiting for the batch file to announce that it has finished.
How can I check if any...
|
by: Salad |
last post by:
I have 2 apps; one written in A97, the other in A2003. If I open an app
in A97 then close it, then open Explorer and dbl-click on the A2003 mdb,
I'm informed it's an unrecognized format. If I open an app in A2003 and
close it, then dbl-click on the A2003 app in Explorer, it opens fine.
Is there a way for opening an app in explorer to use the correct version
of Access to open it?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |