Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Custom GDI+ class
Storing content of the Clipboard to a bitmap file
Displaying icons in the system tray (VFP9)
How to print FoxPro form
GDI+: Implementing image scrolling with inertia
Storing screen shot of a form to bitmap file
Monitoring clipboard content changes (VFP9)
Obtaining names and positions for shortcuts located on the Windows Desktop
How to print a bitmap file
Displaying dimmed window behind VFP top-level form
Using InternetSetFilePointer when resuming interrupted download from the Internet
Capturing keyboard activity of another application with the Raw Input API (VFP9)
How to view icons stored in executable files (Icon Viewer) - II
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
GDI+: reading and writing metadata in JPEG and TIFF files
HOWTO: Use the Win32 API to Access File Dates and Times
How to change display settings: screen resolution, screen refresh rate
Browsing Windows Known Folders (Special Folders)
Printing Image File, programmatically set print page orientation to landscape
Using EnumPrinters function to enumerate locally installed printers
Using NetWkstaTransportEnum to obtain MAC Address of remote server
Attaching menu to a top-level form
Using the LoadImage function to have a bitmap file loaded and displayed on VFP main window
Enumerating Processes -- WinNT
Detecting changes in connections to removable drives (VFP9)

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Versions:
click to open
Before you begin:
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.

See also:
  • Disconnecting USB Mass Storage Device programmatically
  • Mapping and disconnecting network drives
  • Enumerating Volumes and Volume Mounting Points
  •  
      Members area. Log in to view this example.
     
      User name:
      Password:
     
     
      Forgot your password?
     
      Sign up for
    the Membership
     
     


    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    10044 bytes  
    Created: 2011-01-07 17:18:05  
    Modified: 2011-05-06 09:05:14  
    Visits in 7 days: 147  
    Listed functions:
    CallWindowProc
    DestroyIcon
    GetDiskFreeSpace
    GetDriveType
    GetVolumeInformation
    GetWindowLong
    SendMessage
    SetWindowLong
    SHGetFileInfo
    Printer friendly API declarations
    My comment:
    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.
    [AutoRun]
    open=Setup.exe
    icon=Setup.exe
    label=Linksys Router Setup
    action=@Setup.exe,-10001

    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.

    Use GetPrivateProfileString function for retrieving values from .ini and .inf files.

    * * *
    MIcrosoft Support, Article 163503. How to receive notification of CD-ROM insertion or removal
  • Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian  
    FreeTranslation.com offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.


    Copyright 2001-2017 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

    Privacy policy
    Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (54.224.18.114)
    19 sec.Example: 'Sending email messages with Simple MAPI'
    36 sec.
    56 sec.Function: 'waveOutUnprepareHeader'
    Function group: 'Windows Multimedia'
    1.23 min.Function: 'waveOutGetPosition'
    Function group: 'Windows Multimedia'
    1.58 min.Function: 'FindClosePrinterChangeNotification'
    Function group: 'Printing and Print Spooler'
    1.9 min.Updates
    2.28 min.
    Function group: 'System Information'
    2.77 min.Function: 'GetNumberOfPhysicalMonitorsFromHMONITOR'
    3.2 min.Example: 'How to make a VFP form fading out when released (GDI+ version)'
    3.65 min.Function: 'mmioDescend'
    Function group: 'Windows Multimedia'
    Google
    Advertise here!