🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #304

Re: How to eject CD tray

#304
From: Bob Gonder
Date: Wed, 04 Jun 2008 15:59
21 lines
1733 bytes
Colin B Maharaj wrote:

>Interesting question, however I installed an application
>by a customer recently and the setup program had an option
>to eject the CD.
>
>Question: How to tell which drive you are in and relate it
>the the drive you are ejecting...

I usually think DeviceIoControl() which uses a
CreateFile() handle, so it's easy to relate.

As to which drive, GetModuleFileName() should
contain the drive letter.
GetCommandLine() should also have the drive letter.

Here is a Delphi version using DeviceIoControl
http://delphi.newswhat.com/geoxml/forumhistorythread?groupname=borland.public.delphi.nativeapi.win32&messageid=412e698d@newsgroups.borland.com

And an old, much less complete C++
http://groups.google.com/group/borland.public.cppbuilder.winapi/browse_thread/thread/bb0df3d6c2fd135c
Technical Details
Message-ID: <5kdd44p67hp9th00mjrrvuv54pplb6uo9q@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder.news-service.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <48450FE9.6260731F@ulb.ac.be> <48455251@newsgroups.borland.com> <4846745f$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,2231c67b2a0d974
X-Google-Attributes: gid10cc67,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: How to eject CD tray
Date: Wed, 04 Jun 2008 08:59:33 -0700
Message-ID: <5kdd44p67hp9th00mjrrvuv54pplb6uo9q@4ax.com>
References: <48450FE9.6260731F@ulb.ac.be> <48455251@newsgroups.borland.com> <4846745f$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.77.145.251
X-Trace: newsgroups.borland.com 1212595170 67.77.145.251 (4 Jun 2008 08:59:30 -0700)
Lines: 23
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder.news-service.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail