How to use Shell.Application to eject a USB device on Windows XP?
NickName:P4aszk4 Ask DateTime:2022-03-08T19:16:27

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").NameSpace("E:").Self.InvokeVerb "Eject"
End Sub

The above script that I found works on Windows 7 but not on XP.
If someone could give me an example of how to eject on Windows XP, that would be great.

Copyright Notice:Content Author:「P4aszk4」,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/71394118/how-to-use-shell-application-to-eject-a-usb-device-on-windows-xp

More about “How to use Shell.Application to eject a USB device on Windows XP?” related questions

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

Programmatically Eject USB Device while it is in use

How can i programmatically eject USB Device even if it is in use? Scenarios: USB device attached to the system. We get WM_DEVICECHANGE message by "RegisterDeviceNotification" through which we can

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

Cannot eject USB drive on XP even after TFileStream is freed

I am using Delphi XE3. Below is my code: procedure TForm1.Button1Click(Sender: TObject); var Data: Byte; FileStream: TFileStream; begin if SaveDialog1.Execute then begin FileStream :=

Show Detail

Cannot eject USB drive on XP even after TFileStream is freed

I am using Delphi XE3. Below is my code: procedure TForm1.Button1Click(Sender: TObject); var Data: Byte; FileStream: TFileStream; begin if SaveDialog1.Execute then begin FileStream :=

Show Detail

USB device location on windows XP

I'm trying to group USB devices based on their parent hub by using the SetupDiGetDeviceRegistryProperty function with the SPDRP_LOCATION_INFORMATION property. On windows 7 it's working great - the

Show Detail

c# Eject USB - code for LockVolume, DismountVolume, and PrepareRemovalOfVolume

I am struggling trying to create an application capable to eject any USB mass storage device. After many tries, I am finally using some code found in codeproject https://www.codeproject.com/Articles/

Show Detail

powershell command to eject the device connected through usb does not work first time

I have a java application which interacts with a device connected through USB drive. I want to eject the device after processing. The below command works, but I have to try in a loop to make sure its

Show Detail

Obtaining GUID for Existing USB Device on Windows XP

I need to find the GUID for an existing USB device attached to my Windows XP system. How can this be done using WMI or the registry? Or, is there another avenue that I should explore? Thanks.

Show Detail

How to detect an incoming USB device in windows Service on Windows XP machine?

I an trying to write a simple Windows Service that shall detect any incoming USB device and Launch a GUI application. WqlEventQuery query = new WqlEventQuery("SELECT * FROM

Show Detail