Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Using the DeleteFile
Using the Semaphore object
Winsock: how to retrieve the protocol information corresponding to a protocol number
CryptoAPI: Collection of Providers class
GDI+: retrieving list of available image encoders and image decoders
GDI+: Using Scale and Shear transformations
Obtaining I/O counts for the current process
Printing text with the Escape function
Reading and setting system access privileges for the current process
Reading security permissions for NTFS files and folders
Using shared memory to exchange data between two FoxPro applications
Using the MessageBox Win32 function
Writing entries to custom Event Log
How to retrieve version information for the specified file
Retrieving top-child window for the VFP form
Saving available locale records into a cursor
Using custom Simple MapiSendMail class
GDI+: cropping images
How to write and read Window Properties for the specified window
MapiSendMail class for Visual FoxPro application
Pocket PC: enumerating mounted database volumes and databases in the Object Store
Retrieving current user for the process
Retrieving information specific to the current Time Zone
Retrieving window and menu help context identifiers
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: 45  
    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 (23.22.252.150)
    5 sec.Function: 'GetLengthSid'
    Function group: 'Security'
    8 sec.Example: 'GDI+: sending image of FoxPro form to printer'
    Language: 'C#'
    1.53 hrs.Function: 'waveOutSetVolume'
     Function: 'GetModuleHandle'
    Function group: 'Dynamic-Link Library'
    4.3 hrs.Example: 'Retrieving information about the specified icon'
    4.31 hrs.Example: 'Exporting DLL icon resources as .ICO files'
    7.14 hrs.Function: 'FrameRgn'
     Example: 'Starting a dialog box for connecting to network resources and passing input parameters'
    10.4 hrs.Function: 'GdipRotateWorldTransform'
     Example: 'Retrieving configuration information for the specified server (Win2000/XP)'
    Google
    Advertise here!