Using Win32 functions in Visual FoxPro Image Gallery
Shell Functions
..msdn
AssocQueryString
DllGetVersion
DragAcceptFiles
DragFinish
DragQueryFile
DragQueryPoint
FileIconInit
FindExecutable
GetFileNameFromBrowse
GetMenuContextHelpId
GetWindowContextHelpId
InetIsOffline
IsUserAnAdmin
LoadUserProfile
PathMakeUniqueName
PathYetAnotherMakeUniqueName
RealDriveType
RestartDialog
SHAddToRecentDocs
SHBrowseForFolder
SHCreateDirectory
ShellAbout
ShellExecute
ShellExecuteEx
Shell_GetImageLists
Shell_NotifyIcon
SHEmptyRecycleBin
SHFileOperation
SHFormatDrive
SHGetFileInfo
SHGetFolderPath
SHGetPathFromIDList
SHGetSpecialFolderLocation
SHGetStockIconInfo
SHParseDisplayName
SHQueryRecycleBin
SHSimpleIDListFromPath
UnloadUserProfile
WinHelp
Code examples:
Deleting files into the Recycle Bin
Displaying standard progress dialog box when copying files
How to remove a directory that is not empty
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: 59  
    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-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 (54.226.33.117)
    26 sec.Function: 'ClosePrinter'
    Function group: 'Printing and Print Spooler'
    57 sec.Function: 'RealDriveType'
    Function group: 'Shell Functions'
    1.47 min.Example: 'Pocket PC: custom RAPI class for operating with files and folders on mobile device'
    2.02 min.
    Function group: 'Extensible Storage Engine (ESE, Jet Blue)'
    2.6 min.
    Function group: 'Windows Controls'
    3.17 min.Function: 'SetComputerName'
    3.78 min.Function: 'CeWriteRecordProps'
    Function group: 'Remote Application Programming (RAPI)'
    4.42 min.Function: 'UnloadUserProfile'
    Function group: 'Shell Functions'
    5.08 min.Function: 'InetIsOffline'
    Function group: 'Shell Functions'
    5.82 min.Function: 'waveInAddBuffer'
    Function group: 'Windows Multimedia'
    Google
    Advertise here!