Eject Flash Disk is currently used by the application in Windows
NickName:Vas Ask DateTime:2018-02-13T23:10:07

Eject Flash Disk is currently used by the application in Windows

I am trying to find a way from a c++ program to (remove, release, clear, etc...) the directory path that used to open a file from an external hard drive (flash disks) and cause the flash disk not to be able to eject with the classic error in windows (it is being used by an application)

The problem is that when you open a file by a c++ program and this file is on an external hard drive even if you close the file, it can't eject the external drive until you close the program that opened that file or the path to that external drive.

I tried to use SetCurrentDirectory() after each use of a file function in windows but it doesn't seem to work properly.

It still needs something to be released by the program so the external disk can be ejected.

Did anyone find a way to do this?

-------------- UDPATE

Michael Walz is correct. FindClose(); for some cases CloseHandle(); for other cases seems to be working fine by now as far as i tested.

Copyright Notice:Content Author:「Vas」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/48769883/eject-flash-disk-is-currently-used-by-the-application-in-windows

More about “Eject Flash Disk is currently used by the application in Windows” related questions

Eject Flash Disk is currently used by the application in Windows

I am trying to find a way from a c++ program to (remove, release, clear, etc...) the directory path that used to open a file from an external hard drive (flash disks) and cause the flash disk not t...

Show Detail

Eject disk if inserted media is blank with applescript

I am hoping to create a custom applescript that will automatically eject my optical drive if the inserted cd is blank. I'm new to applescripts, and would greatly appreciate some input on how to fin...

Show Detail

Eject USB-Disk via Powershell Script

I tried this code to eject the usb-device: $drive = New-Object -ComObject Shell.Application $drive.NameSpace(17).Parsename("E:").InvokeVerb("Eject") It worked on USB-Sticks. Ho...

Show Detail

How to Eject a Flash drive in Batch or Vbs

I'm trying to eject my flash drive when i type eject into a command prompt, i have a shell of a code, but i don't have the actual code to eject it. UNLOCK @echo off echo ' set "psCommand=powersh...

Show Detail

How to use Shell.Application to eject a USB device on Windows XP?

I'm new to coding and I have never used Visual Basic before. I was asked to write a script that ejects the USB drive. Public sub cmdClose_Click() 'CreateObject("Shell.Application").

Show Detail

How to eject a USB removable disk/volume, similar to the "Eject" function in Windows Explorer?

Do you know what is the API, or sequence of API calls that windows uses to accomplish the "Eject" function which is available on the shell context menu for removable volumes? So far I've tried two

Show Detail

Java - Will the application still run after USB eject

Hello stackoverflow users, I am here with a very simple question. The title might say it all, but let me explain it again: I have an application that is on my USB flash drive. When I run the appli...

Show Detail

Eject usb drive from Windows Service c#

I have been developing windows service which needs to Eject USB drive in some cases. I have been using the code project sample code Its working fine in desktop/Winforms application but not in the

Show Detail

Reading USB flash disk issue

I am using Visual Studio Team System 2008, C#, .NET 3.5, IIS 7.0, and ASP.NET. I am using Silverlight 3.0 as well. I want to read the content of a USB flash disk at the client side, using the

Show Detail

A _disk_id.pod file appears on a windows flash drive

What causes a   _disk_id.pod   file to appear on a windows flash drive, and is it advisable to remove it?

Show Detail