Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to enumerate, add and delete shares on the local computer (WinNT/XP)
HOWTO: Use the Win32 API to Access File Dates and Times
Mapping and disconnecting network drives
Saying "Hello World!" with VFP and WinAPI
Testing serial ports
Using FtpCommand
Converting Unicode data from the Clipboard to a character string using a given code page
Creating hash values for the list of names
Enumerating Performance Counters
Enumerating Volumes and Volume Mounting Points (NTFS)
How to block the PrintScreen key
How to retrieve the number of print jobs queued for the printer
Round FoxPro form
Time in milliseconds represented as string (e.g. 1 hour 24 min 36 sec)
Using InternetSetFilePointer when resuming interrupted download from the Internet
Creating an Open dialog box to specify the drive, directory, and name of a file to open (Shell32 version)
Displaying system dialog that selects a folder
Dragging files from Explorer window and dropping them on FoxPro control (requires VFP9)
Locking the workstation
Obtaining list of tables stored in an ODBC Data Source
Start an executable from VFP application by using the CreateProcess
Using Change Notification Objects to monitor changes to the printer or print server
Winsock: retrieving directory listing from an FTP server using passive data connection (FTP, port 21)
Converting path to original case
How to enumerate, add and delete shares on the local computer (WinNT/XP)

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:
This code sample presents the SharedResources class that encapsulates a collection of the SHARE_INFO_2 objects.

Note that all NetShare API calls require Unicode string parameters.

Use the following code to test the SharedResources class:

LOCAL oShares As SharedResources, oShare As Share_Info_2
oShares = CREATEOBJECT("SharedResources") && local computer

FOR EACH oShare IN oShares.shares
        IF oShare.sharetype=0 && disk drive
                ? FromUnicode(oShare.sharename) + "=" +;

See also:

  • Enumerating network resources
  • Mapping and disconnecting network drives in FoxPro application
  • Retrieving lists of servers of the specified type visible in the primary domain (WinNT/2K)
  • Enumerating sessions established on a server

      Members area. Log in to view this example.
      User name:
      Forgot your password?
      Sign up for
    the Membership

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    8664 bytes  
    Created: 2002-12-17 19:43:04  
    Modified: 2011-12-10 09:20:22  
    Visits in 7 days: 75  
    Listed functions:
    Printer friendly API declarations
    My comment:
    Code rewritten: Dec.2, 2005

    Administrator, Power User, Print Operator, or Server Operator group membership is required to successfully execute the NetShareEnum function at levels 2 and 502.

    The ANETRESOURCES( ) function places the names of network shares or printers into an array and then returns the number of resources.

    * * *

    Take a look at Scripts to manage Shared Folders on ActiveXperts Software.
    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-2018 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.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (
    21 sec.
    Function group: 'Virtual Hard Disk (Win7)'
    38 sec.
    Function group: 'Clipboard'
    57 sec.Function: 'FtpOpenFile'
    1.23 min.Function: 'SetFilePointerEx'
    Function group: 'File Management'
    1.53 min.Function: 'SetSearchPathMode'
    Function group: 'File Management'
    1.83 min.Function: 'CreateProcess'
    Function group: 'Process and Thread'
    2.12 min.Function: 'FindCloseChangeNotification'
    Function group: 'File Management'
    2.42 min.Function: 'NetFileClose'
    Function group: 'Network Management'
    2.73 min.Function: 'CeMoveFile'
    Function group: 'Remote Application Programming (RAPI)'
    3.05 min.Function: 'WinHelp'
    Function group: 'Shell Functions'
    Advertise here!