windows-explorer

Strange exception with file access and explorator windows

烈酒焚心 提交于 2019-12-08 04:32:28
问题 Consider this simple program: private static void Main(string[] args) { var directoryName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Directory"); if (Directory.Exists(directoryName)) Directory.Delete(directoryName, true); Directory.CreateDirectory(directoryName); var stream = File.Create(Path.Combine(directoryName, "File")); //throws stream.Close(); } This works fine while you simply execute this program. The strange thing happens if you browse that

How to close Windows Explorer windows with opened folders from a certain drive

若如初见. 提交于 2019-12-07 16:55:29
问题 I'm writing a small app that will allow a user to eject (or safely remove) a USB drive. My app works fine, except the situation when a folder on the USB drive (or several folders) are opened in Windows Explorer. In that case the eject function fails as the drive appears to be locked. So I'm curious, since the user is issuing a command through my app to eject the USB drive, is there any way to make Explorer close those open windows from the USB drive? PS. Note that I don't want to close all

Pass multiple files / folders from windows explorer to external application

可紊 提交于 2019-12-07 07:29:10
问题 Hi does anyone know how to get windows explorer to pass multiple files / folders through to an external app (c#) referenced in the registry? I am current able to act upon a single file / folder using the %1 syntax but not sure how to get explorer to pass through multiple items. Does anyone know how to do this? 回答1: When you select multiple files in Explorer, your shell context menu extension's IShellExtInit::Initialize method will be called and pdtobj contains the selection. Note writing

How to mimic a drive in Windows

为君一笑 提交于 2019-12-06 16:01:12
I recently had a look at the Google Data API. Its looking good. What I want to do is create a "G Drive" Type application. This will basically come up as a drive in explorer with its own icon. From there you will be able to drag and drop operations to and from Google Docs, and create folders. Yes I've heard of Gladinet and Memeo, but both are not great solutions. I've decided to build one from the ground up, and release it as open source, once its in Alpha. Anyways to get started I need some advise. Clearly I need a way to mimic a drive in explorer. Is it possible to create some kind of virtual

IShellWindows::FindWindowSW returning S_FALSE

孤者浪人 提交于 2019-12-06 15:36:45
I am trying to get the IDispatch * of an open explorer window using IShellWindows::FindWindowSW ; however, I cannot seem to coax the method to return anything other than S_FALSE. The code I am using is basically: OleInitialize(nullptr); CComPtr<IShellWindows> spWindows; auto hr = spWindows.CoCreateInstance(CLSID_ShellWindows); auto pidl = ILCreateFromPath(L"C:\\temp"); VARIANT vtLoc; vtLoc.vt = VT_VARIANT | VT_BYREF; vtLoc.pbVal = (BYTE *) pidl; CComVariant vtEmpty; long lhwnd; CComPtr<IDispatch> spdisp; hr = spWindows->FindWindowSW(&vtLoc, &vtEmpty, SWC_EXPLORER, &lhwnd, SWFO_NEEDDISPATCH |

How to get HWND of the currently active Windows Explorer window?

空扰寡人 提交于 2019-12-06 14:27:54
问题 I know how to get the HWND of the desktop: GetDesktopWindow(). But I haven't been able to find a function that returns the HWND of the currently active Windows Explorer main window. How do I get the HWND of the currently active Windows Explorer window in a safe and reliable manner? 回答1: You can get the currently active window via GetForegroundWindow(). You could then do GetWindowThreadProcessId() to get a PID which you can then convert to a process handle with OpenProcess() (you will want

Reading Explorer.exe's Thunk Data

和自甴很熟 提交于 2019-12-06 13:01:13
问题 I'm trying to do a little IAT hooking in explorer.exe. Specs: Windows 7 x64, Visual C++. I've made it to a point where I am capable of reading thunk data from any executable of my choosing except for C:\Windows\Explorer.exe. When I run my program against that I receive an access violation in reading memory from that executable. However, when I run this against C:\Windows\system32\Explorer.exe and C:\Windows\sysWOW64\Explorer.exe I don't have any problems. Why is this? Is C:\Windows\Explorer

File explorer java

不羁的心 提交于 2019-12-06 11:58:18
I'd like to have some kind of file browser like Windows Explorer inside a Java Application. I just want something that's able to list file inside a folder recursively. Is there a simple way to do this ? I already tried to use JFileChooser but it's not what I want. This snippet allows you to list all files recursivly. You could use the data to populate a JTree see this tutorial public class Filewalker { public void walk( String path ) { File root = new File( path ); File[] list = root.listFiles(); for ( File f : list ) { if ( f.isDirectory() ) { walk( f.getAbsolutePath() ); System.err.println(

How to get the process id of Explorer launched from Powershell

蓝咒 提交于 2019-12-06 11:38:38
I started "Explorer.exe" from Powershell and want to get the process id of the explorer window so that I would not mis-operate on other explorer windows. Code: Start-Process "Explorer.exe" -PassThru Result: I can see the process id but it's different with the real process id of the window in UISpy or in task manager. Seems explorer.exe start another process (B) can exit itself and finally we see the process (B). And the process I got is the exited process. Question: How can I get the real process id (B)? Explorer.exe will momentarily start a brand new process, but that process will die quickly

Opening a file system folder/directory from web browser

冷暖自知 提交于 2019-12-06 06:22:09
问题 I distribute my desktop application on flash drives to thousands of users on Windows, Mac, and Linux. I have a HTML starter page that has links to the documentation, install guide, release notes, etc. which are all on the flash drive. I would love for the user to just install directly from the browser, but that's exactly what anti-virus programs are trying to prevent (and rightly so). Instead of trying to launch the installer, it's enough to locate the installer and let the user take the last