Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Winsock: sending email messages (SMTP, port 25)
Custom GDI+ class
Obtaining names and positions for shortcuts located on the Windows Desktop
GDI+: Implementing image scrolling with inertia
Storing content of the Clipboard to a bitmap file
Displaying icons in the system tray (VFP9)
Storing screen shot of a form to bitmap file
How to put a horizontal text scrolling on the form (a news line, marquee)
How to print FoxPro form
Printing Image File, programmatically set print page orientation to landscape
Browsing Windows Known Folders (Special Folders)
How to change display settings: screen resolution, screen refresh rate
Windows Shell Icons displayed and exported to ICO files (Vista)
Vertical Label control
How to make a VFP form fading out when released (GDI version)
Displaying dimmed window behind VFP top-level form
Subclassing CommandButton control to create BackColor property
Custom FTP Class for Visual FoxPro application
How to ping a remote site using IP Helper API calls
How to display Windows On-Screen Keyboard
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Enumerating devices installed on the local machine
Pocket PC: custom RAPI class for operating with files and folders on mobile device
Writing entries to custom Event Log
Monitoring changes occurring within a directory

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
click to open
Before you begin:
To stop the following code after it has been started, open and save any file in C:\TEMP directory.

See also:
  • FileSystemWatcher ActiveX Control for Visual FoxPro
  • Monitoring changes in a directory
  • Enumerating files opened on the network
  • using System;
    using System.IO;
    namespace DirectoryWatcher
        class Program
            static void Main(string[] args)
                FileSystemWatcher fsw = new FileSystemWatcher();
                fsw.Changed += 
                    new FileSystemEventHandler(fsw_Changed);
                fsw.Created +=
                    new FileSystemEventHandler(fsw_Changed);
                fsw.Deleted +=
                    new FileSystemEventHandler(fsw_Changed);
                fsw.Renamed +=
                    new RenamedEventHandler(fsw_Renamed);
                fsw.IncludeSubdirectories = true;
                fsw.NotifyFilter = NotifyFilters.LastAccess | 
                    NotifyFilters.LastWrite | 
                    NotifyFilters.FileName | 
                    //make sure the target path can be accessed
                    fsw.Path = @"c:\temp";
                    fsw.EnableRaisingEvents = true;
                catch (ArgumentException ex)
                        "Invalid argument: " + ex.Message);
                catch (Exception ex)
                        "Exception: " + ex.Message);
            static void fsw_Renamed(object sender, RenamedEventArgs e)
                Console.WriteLine(e.ChangeType + ": " + 
                    e.OldFullPath + " to " + e.FullPath);
            static void fsw_Changed(object sender, FileSystemEventArgs e)
                Console.WriteLine(e.ChangeType + ": " + e.FullPath);

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    1731 bytes  
    Created: 2003-05-09 09:16:21  
    Modified: 2011-02-16 13:28:54  
    Visits in 7 days: 83  
    Listed functions:
    Printer friendly API declarations
    My comment:
    To stop the following code after it has been started, open and save any file in C:\TEMP directory.

    * * *
    The C++ sample displays file and directory changes for drive C in a console window. Close the window when you no longer need it.

    This code itself makes an interesting tool. Download C++ project, compile and start the executable. Then open VFP or IE window, or even move the mouse above the Windows taskbar -- you will see how many files and directory modifications may hide behind such a simple action.

    * * *
    Deleting a directory with subdirectories into the Recycle Bin produces a single FILE_NOTIFY_INFORMATION structure with the directory data. While a direct delete (the Recycle Bin is bypassed) triggers ReadDirectoryChangesW for each subdirectory, and finally for the directory.

    * * *
    When designing a file monitoring utility (FLL or ActiveX control), it should be considered that VFP creates single threaded applications.

    While busy with processing directory changes, an application is unable to receive other changes coming. Frequent changes and substantial processing time make such miss unavoidable.

    Thus a VFP application must receive not the actual directory changes, but rather be notified when they occur. Notifications may come through window messages or by events raised.

    A monitoring utility must take care of piling changes in its own memory, and dispatching them to a client application upon request.
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.

    Copyright 2001-2016 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.33), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (
    17 sec.Function: 'NetApiBufferSize'
    Function group: 'Network Management'
    38 sec.
    Function group: 'Data Decompression Library'
    1.5 min.Function: 'VirtualAllocEx'
    Function group: 'Memory Management'
    3 day(s)Function: 'GetIconInfo'
    Advertise here!