Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
FindText -- the hopeless and useless Common Dialog
GDI+: reading and writing metadata in JPEG and TIFF files
How to display picture stored in enhanced-format metafile (*.emf)
Obtaining a handle to the desktop associated with the calling thread
Creating a unique filename based on existing filename
Dial the Net Automatically
GDI+: creating scaled copy of image file
Retrieving various system metrics
Simple Window Viewer
Using the DeleteFile
Attaching menu to a top-level form
Enhanced GetFont dialog
Enumerating Volumes and Volume Mounting Points (NTFS)
How to view icons stored in executable files (Icon Viewer)
How to view icons stored in executable files (Icon Viewer) - II
Using the CreateFile
Enumerating the subkeys for a given registry key
Monitoring changes in a directory
Reading and setting explicit Application User Model ID for the current process (Win7)
Wininet last error description
Winsock: retrieving the host information corresponding to a network address
Displaying Windows shell folders in TreeView control with Visual FoxPro FLL
GDI+: Using Scale and Shear transformations
Retrieving information specific to the current Time Zone
Copying files as a transacted operation (Vista)

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:
Windows Vista offers transaction protection for various file operations: create, delete, copy, move and more.

See also:
  • Displaying standard progress dialog box when copying files
  • Deleting file into the Recycle Bin
  •  
    #DEFINE INVALID_HANDLE_VALUE -1
    #DEFINE COPY_FILE_FAIL_IF_EXISTS 0x00000001
    #DEFINE COPY_FILE_OPEN_SOURCE_FOR_WRITE 0x00000004
     
    DO declare
     
    LOCAL hTrans
    hTrans = CreateTransaction(0, 0, 0, 0, 0, 1000, NULL)
    IF hTrans = INVALID_HANDLE_VALUE
        ? "CreateTransaction call failed:", GetLastError()
        RETURN
    ENDIF
     
    LOCAL cSrc, cDst, nResult
    cSrc = "c:\temp\test.txt"
    cDst = "c:\temp\test1.txt"
     
    nResult = CopyFileTransacted(cSrc, cDst, 0, 0, 0,;
        BITOR(COPY_FILE_FAIL_IF_EXISTS,;
        COPY_FILE_OPEN_SOURCE_FOR_WRITE),;
        hTrans)
     
    IF nResult = 0
        ? "CopyFileTransacted call failed:", GetLastError()
        = RollbackTransaction(m.hTrans)
    ELSE
        = CommitTransaction(m.hTrans)
    ENDIF
     
    = CloseHandle(hTrans)
    * end of main
     
    PROCEDURE declare
        DECLARE INTEGER CopyFileTransacted IN kernel32;
            STRING lpExistingFileName, STRING lpNewFileName,;
            INTEGER lpProgressRoutine, INTEGER lpData,;
            INTEGER pbCancel, INTEGER dwCopyFlags,;
            INTEGER hTransaction
     
        DECLARE INTEGER CloseHandle IN kernel32;
            INTEGER hObject
     
        DECLARE INTEGER CommitTransaction IN KtmW32;
            INTEGER TransactionHandle
     
        DECLARE INTEGER RollbackTransaction IN KtmW32;
            INTEGER TransactionHandle
     
        DECLARE INTEGER GetLastError IN kernel32
     
        DECLARE INTEGER CreateTransaction IN KtmW32;
            INTEGER lpTransactionAttributes, INTEGER UOW,;
            INTEGER CreateOptions, INTEGER IsolationLevel,;
            INTEGER IsolationFlags, INTEGER Timeout,;
            STRING @Description
     

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    1451 bytes  
    Created: 2008-12-04 16:08:39  
    Modified: 2010-07-30 08:32:08  
    Visits in 7 days: 64  
    Listed functions:
    CloseHandle
    CommitTransaction
    CopyFileTransacted
    CreateTransaction
    GetLastError
    RollbackTransaction
    Printer friendly API declarations
    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-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 (54.226.5.29)
    6.57 min.Function: 'GetCursorInfo'
    2.16 hrs.Example: 'Using the LoadImage function to have a bitmap file loaded and displayed on VFP main window'
     Example: 'Using the IsWindowEnabled function'
    6.99 hrs.Function: 'DeviceCapabilities'
    Function group: 'Printing and Print Spooler'
    10.8 hrs.Example: 'How to detect if additional monitor is connected and active'
    12.09 hrs.Example: 'Obtaining OS memory performance information'
    17.67 hrs.Function: 'IsValidSid'
     Example: 'Using mailslots to send messages on the network'
     Function: 'SearchPath'
    Function group: 'File Management'
    17.81 hrs.Example: 'Converting strings between ANSI and OEM'
    Google
    Advertise here!