Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Intel corner

Types of Disk Drives

Whether a disk drive is a CD-ROM or not.

Issue: 2.3 (December/January 2003)
Author: Christian Schmitz, cSchmitz-at-rbdeveloper.com
Author Bio: Christian Schmitz is the creator of the Monkeybread Software REALbasic Plugins.
Article Description: No description available.
Article Length (in bytes): 2,038
Starting Page Number: 42
RBD Number: 2320
Resource File(s): None
Related Link(s): None
Known Limitations: None

Excerpt of article text...

What we want to know

One of our readers sent an email and asked how to check whether or not a path points to a CD-ROM. For Mac OS you can easily check this with a small AppleScript, so he was looking for a solution on Windows.

This article shows a universal function to get the dsk type of a disk based on the drive letter, including network disks.

The declare code

From Microsoft's developer network, we know this function declaration in C:

UINT GetDriveType(

LPCTSTR lpRootPathName // pointer to root path

);

But what is a LPCTSTR? It's a "Long Pointer Constant Tchar STRing". This is basically just a pointer to a C String, which is constant.

REALbasic passes such a constant C string if we declare the string as a "CString". The returned UINT is an unsigned integer. As REALbasic does not have unsigned variable data types, we simply use a signed integer. The final declare with the library "kernel32" looks like this:

declare function GetDriveTypeA lib "Kernel32" (root as CString) as integer

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com