Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Using GetNearestColor
CryptoAPI: Collection of Providers class
GDI+: creating scaled copy of image file
GDI+: Using Scale and Shear transformations
How to write and read Window Properties for the specified window
Minimizing all running applications
Obtaining I/O counts for the current process
Printing text with the Escape function
Retrieving information about MS-DOS device names using QueryDosDevice (WinNT only)
Retrieving window and menu help context identifiers
An alternative way of setting Form.Closable to False
Pocket PC: enumerating mounted database volumes and databases in the Object Store
Reading and setting system access privileges for the current process
Reading entries from Event logs
Retrieving geometrical parameters of the system desktop window
Using Custom FTP class (DEFINE CLASS ftp As Custom)
Using the GetLogicalDriveStrings
Current directory of the application
How to display picture stored in enhanced-format metafile (*.emf)
How to find when the application started
How to retrieve version information for the specified file
Obtaining addresses for the adapters on the local computer (Win XP/2003/Vista)
Retrieving the rectangle area where the mouse cursor is confined
Using SQLBrowseConnect to connect to a data source through a number of iterative calls (SQL Server)
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: 47  
    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 (107.20.129.212)
    4 sec.Function: 'GetWindowsDirectory'
    Function group: 'System Information'
    41.23 min.Example: 'Running a regular FoxPro form while main VFP window is minimized'
    1.27 hrs.Example: 'Writing to INI file'
    2.46 hrs.Function: 'GdipResetWorldTransform'
     Function: 'GetMenu'
    3.5 hrs.Function: 'GdipSetTextRenderingHint'
     Example: 'Testing Transparent Menu Class with top-level form (requires VFP9)'
    5.65 hrs.Example: 'Reading the structure of VFP main menu'
     Example: 'Placing an arbitrary rectangular area of main VFP window on the Clipboard'
    7.15 hrs.Example: 'Retrieving file information for the VFP executable running'
    Google
    Advertise here!