PauloM Posted March 14, 2005 Report Share Posted March 14, 2005 Hello, I want to programmatically eject my USB Flash memory from the PC. In my application, the user doesn't have access to the system tray and to windows explorer (at least I try to...), but he can insert some USB memory drives, to get data from the system. The problem is that, in this way, the drive will be constantly removed from the system without ejecting it. Does anyone know how to eject removable drives from LabVIEW? Thanks in advance for the help, Paulo Quote Link to comment
David Boyd Posted March 17, 2005 Report Share Posted March 17, 2005 I want to programmatically eject my USB Flash memory from the PC. Google on Q165721, a Microsoft KB article (roughly) entitled 'HOWTO: Eject Removeable Media in WinNT/2K/XP'. I didn't read all the way through, looks like they're doing DeviceIOCtrl calls. You may be able to use a couple of CLNs to access the Win32 system to do what you need. Hope this gets you started, Dave Quote Link to comment
rkesmodel Posted May 18, 2007 Report Share Posted May 18, 2007 QUOTE(David Boyd @ Mar 17 2005, 08:47 AM) Google on Q165721, a Microsoft KB article (roughly) entitled 'HOWTO: Eject Removeable Media in WinNT/2K/XP'. I didn't read all the way through, looks like they're doing DeviceIOCtrl calls. You may be able to use a couple of CLNs to access the Win32 system to do what you need.Hope this gets you started, Dave Dave, Interesting link. However, the main problem that Paulo will have is that when LabVIEW accesses a flash drive it keeps a reference open to the drive until LV is completely shut down. There are several programs that will do this (even some MS ones). They will keep a reference open to the last drive they accessed. The only way I have found around this behaviour is to either shut down the offending program or access a different drive (do not know if this works w/LV). Aslo, many of us are CLN 'challenged' and the article is so much Greek . Anyone have a solution out there? Quote Link to comment
Rolf Kalbermatter Posted May 19, 2007 Report Share Posted May 19, 2007 QUOTE(rkesmodel @ May 16 2007, 10:41 PM) Dave,Interesting link. However, the main problem that Paulo will have is that when LabVIEW accesses a flash drive it keeps a reference open to the drive until LV is completely shut down. There are several programs that will do this (even some MS ones). They will keep a reference open to the last drive they accessed. The only way I have found around this behaviour is to either shut down the offending program or access a different drive (do not know if this works w/LV). Aslo, many of us are CLN 'challenged' and the article is so much Greek . Anyone have a solution out there? I don't think it is an application thing really. It is the more likely the "current directory" Windows maintains on a per process base. Various Windows APIs such as the File Dialog box do adjust the current directory to the last directory accessed. So that is where the notion of applications locking a drive may come from. Another one is that LabVIEW keeps a handle to DLLs open as soon as they got loaded into memory until the application closes down completely. I'm sure the new LabVIEW 8.2.1 feature to define the DLL path dynamically at runtime for Call Library Nodes can actually remove that annoyence once the VI accessing that DLL has gone idle. Rolf Kalbermatter Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.