Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Printing text on the client area of the main VFP window
Using the GetTempFileName
Adding printer to the list of supported printers for the specified server
DiskFreeSpace class
Displaying the drive type value
GDI+: Color Transparency
Get the power status of your laptop computer
How to view system icons for the classes installed on the local machine
Reading the state of mouse buttons within DO WHILE loop
Retrieveing information about the active window (even if it is not owned by the calling process)
Returning some basic information for the specified INF file
The DetectAutoProxyUrl function identifies the auto-config script location
Obtaining Shell32.dll version
Removing FTP directory
Using vendor-neutral SQL constructs
A procedure for setting file times
Copying strings through the global memory block
Current keyboard type
Obtaining I/O counts for the current process
Obtaining names of local and global groups for current user (WinNT/XP/2K)
Obtaining physical parameters for a drive: sectors, clusters, cylinders...
Testing MS Internet Explorer version installed
Wininet last error description
Deleting a file stored on the FTP 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: 63  
    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 (50.16.36.153)
    13.55 min.Function: 'WNetGetConnection'
    13.6 min.Example: 'Vertical Label control'
    2.14 hrs.Example: 'Adding an ODBC data source with the SQLConfigDataSource; use automatic or interactive mode'
     Example: 'Changing system colors'
     
    Function group: 'National Language Support'
    2.78 hrs.Example: 'Enumerating the subkeys for a given registry key'
     Example: 'Form Magnifier'
    3.1 hrs.Example: 'Creating the Open dialog box to specify the drive, directory, and name of a file to open'
    3.11 hrs.Example: 'Validating the heap of the calling process'
    3.21 hrs.Example: 'How to change the name and the size of the font in the MessageBox dialog'
    Google
    Advertise here!