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.
|







