Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Shortcut Menu Class
Converting characters in a URL into corresponding escape sequences and backwards
GDI+: how to make VFP controls visually shake and shudder
Creating the Save dialog box to specify the drive, directory, and name of a file to save
Customizing the frame of top-level form: removing the standard frame (VFP9, Vista)
How to retrieve information about a cache entry (Internet Explorer)
Initiating Inet connection using a modem
Retrieving names for the registered clipboard formats
Using the IsWindowEnabled function
Using the NetMessageBufferSend to send messages on the network
Downloading files from the FTP server using InternetReadFile
How to enumerate, add and delete shares on the local computer (WinNT/XP)
How to suspend or hibernate your system
Reading entries from Event logs
Storing screen shot of a form to bitmap file
Winsock: retrieving the host information corresponding to a network address
Adding and deleting User Accounts
Obtaining list of tables stored in an ODBC Data Source
Retrieveing information about the active window (even if it is not owned by the calling process)
Starting a dialog box for connecting to network resources (mapping network drive)
Enumerating print processors and supporting data types installed on the specified server
How to retrieve version information for the specified file
Locking mouse and keyboard input for the VFP application
How to delete IE cookies, clear IE history and delete files in Temporary Internet Files directory
Displaying standard progress dialog box when copying files

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
Before you begin:
If you`ve been thinking about retiring ageing VFP commands COPY FILE and RENAME then give this code a try.



See also:
  • How to remove a directory that is not empty
  •  
      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:
    • ~
    7057 bytes  
    Created: 2006-03-07 14:33:18  
    Modified: 2011-12-10 09:20:22  
    Visits in 7 days: 117  
    Listed functions:
    GlobalAlloc
    GlobalFree
    GlobalSize
    SHFileOperation
    Printer friendly API declarations
    My comment:
    The SHFileOperation copies, deletes and moves a file or multiple files. It requires a single parameter that points to a SHFILEOPSTRUCT structure. The structure has to be populated before calling the function.

    Most of the SHFILEOPSTRUCT members are easy to populate except may be pFrom and pTo since they are pointers to strings with no direct support in VFP for this kind of objects. Class PChar inside the code handles string pointers. It allocates and releases memory blocks and moves data between VFP strings and an address in memory.

    A variety of flags the fFlags member can take provides great flexibility. For example, in a single SHFileOperation call a group of files can be copied not to just one but to several destinations. The process is accompanied with familiar OS dialogs showing the progress or sending a reminder when existing file is about to be replaced.

    * * *
    The Shell is as usual brief and efficient. The following code copies all files from the source folder to the target folder. Test with care:

    LOCAL oShell, oSrcFolder, oDstFolder

    oShell = CREATEOBJECT("Shell.Application")
    oSrcFolder = oShell.NameSpace("c:\temp1")
    oDstFolder = oShell.NameSpace("c:\temp")

    IF VARTYPE(oDstFolder)="O" AND VARTYPE(oSrcFolder.Items)="O"
            oDstFolder.CopyHere(oSrcFolder.Items)
    ENDIF
    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:
    Craig Bailey | 2006-03-09 03:20:14
    Small typo - I think line 208 should use buf2dword instead of buf2word (for the This.aborted check.
    Other than that works great.
    A.M. | 2006-03-09 07:59:03
    Craig, thanks! It's fixed now.
    Lewis Harris | 2007-04-13 12:25:00
    I am using VFP 9 SP1 on WINXP and I can't get this to work
    the second namespace command never creates an object it stays null in the debugger.

    any ideas


    LOCAL oShell, oSrcFolder, oDstFolder

    oShell = CREATEOBJECT("Shell.Application")
    oSrcFolder = oShell.NameSpace("c:\temp1")
    oDstFolder = oShell.NameSpace("c:\temp")

    IF VARTYPE(oDstFolder)="O" AND VARTYPE(oSrcFolder.Items)="O"
        oDstFolder.CopyHere(oSrcFolder.Items)
    ENDIF

    Copyright © 2001-2013 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.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (50.19.155.235)
    4 sec.Example: 'Reading entries from Event logs'
    1.65 hrs.Example: 'How to hide your program from the Close Program dialog (Win9* only)'
    6.99 hrs.Example: 'Establishing connection using the SQLDriverConnect'
    11.83 hrs.Function: 'SetSysColors'
    12.7 hrs.Example: 'How to create transparent areas inside a form -- punching holes in the form'
     Function: 'GetClassInfo'
    13.19 hrs.Example: 'How to find the application associated with a file name'
    13.2 hrs.Example: 'Using Change Notification Objects to monitor changes to the printer or print server'
    23.27 hrs.Example: 'Creating irregularly shaped FoxPro form using transparency color key'
    1 day(s)Example: 'Printing text with the Escape function'
    Google
    Advertise here!