Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Shutdown and Eject USB Disk

Posted on 2005-05-16
9
Medium Priority
?
3,085 Views
Last Modified: 2007-11-27
Hi all,
Anyone can help me how to create a function to shutdown/eject USB Disk just what windows done by click Safely Remove Hardware Icon in systray. I wonder there's a function with drive parameter, examp: ShutDownUSB(driveletter: char)

Sirro
0
Comment
Question by:matelindonesia
9 Comments
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 14010454
The function is called CM_Request_Device_Eject and is located in the Config Manager API.
Get both Zips from http://www.sf.net/projects/jedi-apilib
In "Setup and Config Manager API" you will find an example precisely for what you want to do.
0
 

Expert Comment

by:sirro
ID: 14015909
I've try the example code, and installed the JEDI component(JVCL and JCL), but why it always ask the JwaDbt unit?

FYI I used Jedi component ver 3.00

Thanks
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 14015962
Because this is the Jedi-Apilib which is a conversion of the Win32 API.
Add the path to the directory where you unpacked the jedi-apilib files to the library path of Delphi.
Also to the Setup API conversion.
Sorry, these files have no installer yet.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:matelindonesia
ID: 14016109
Oke, I've add the library path for win32 api and Setup API Conversion, It works, but why whe it entered the FillDriveList procedure, excatly on GetDriveInstanceID procedure it raised EAccessViolation.
FYI I've code on WinXP OS with SP2, is it make any influence?
0
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 1000 total points
ID: 14016674
Please debug further. I see no obvious bugs.
For the debugging contact me directly robert_marquardt att gmx dott de
No need to discuss that here.
0
 

Author Comment

by:matelindonesia
ID: 14044927
Thanks to robert_marquardt,

I finally got solution after looking for it since last year,
BRAVO ...!!!

:)

Regards
Sirro
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 14045112
For other readers:
The problem with the demo program was that i tested it only under Win 2000.
The bug in the Setup API conversion was Win XP specific. That resulted in the demo not being able to access the Setup API at all when compiled for Win XP.

I do know more about CM_Request_Device_Eject. Better not try to use it from a service.
There are numerous quirks in that API resulting in unwanted Surprise Removal dialogs popping up.
0
 
LVL 3

Expert Comment

by:emce
ID: 14286537
I got the same problem, how do I solve it? Please help.
Regards,
Maciek
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 14287632
The bug is in cfgmgr32.pas. I converted CM_Is_Version_Available and CM_Is_Version_Available_Ex, but these functions are not in cfgmgr32.dll.
Search for "CM_Is_Version_Available" and comment out *all* occurrences.
These functions are in fact a bad trick of MS Visual Studio. It uses cfgmgr.lib instead of cfmgr32.lib to link to the DLL and these functions
are implemented in the lib whereas most other functions are delegated to the DLL as usual.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question