VFP application can receive system notifications when a disk drive gets connected or disconnected (USB, network drive).
In this code sample, a ListView control on VFP form displays available disk drives using matching icons and descriptions.
Note that this code sample requires VFP9 version of the BINDEVENT() function. The one that can handle Windows messages.
The WM_DEVICECHANGE message notifies an application of a change to the hardware configuration of the computer.
Upon locking and ejection of removable storage devices (not limited to), the system broadcasts the WM_DEVICECHANGE message to notify applications and device drivers about changes in the configuration.
Examples of events that trigger the broadcasting of WM_DEVICECHANGE message:
USB flash drive inserted or ejected
external hard drive connected to USB port, or ejected
network drive mapped or disconnected
CD inserted in CD drive, or ejected
The main Visual FoxPro window ( _vfp.HWnd ) and any top-level form ( ShowWindow=2, ThisForm.HWnd ) normally receive WM_DEVICECHANGE messages.
VFP application can also deny or grant system requests for device removal (yet to be covered in this or another code sample).
* * *
.NET version of this code sample:
* * *
An installation CD/DVD disk may contain Autorun.inf file. Here is an example of the content.
It makes sense, and Windows Explorer apparently behaves this way, depicting a device using whenever available the AutoRun.Label string, and the icon retrieved from the file the AutoRun.Open points at.
Credits: PHP (4.4.9), an HTML-embedded scripting language,
MySQL (5.1.55-log), the Open Source standard SQL database,
AceHTML Freeware
Version 4, freeware HTML Editor of choice. Hosted by Korax Online Inc.