Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
GDI+: printing vertical text on VFP reports via generated images (VFP9)
How to display the Print property sheet
Retrieving top-child window for the VFP form
Splash Screen for the VFP application
Using the SetErrorMode for determining if a floppy drive is ready
A client for testing non-blocking Winsock server
GDI+: reading and writing metadata in JPEG and TIFF files
How to disable the Windows Clipboard (VFP9)
Animating a transition of the VFP form (a wire-frame rectangle)
Displaying animated images on FoxPro form with BitBlt and StretchBlt functions
Dragging files from Explorer window and dropping them on FoxPro control (requires VFP9)
How to copy the image of a form to the Clipboard using Bitmap API functions
Converting command-line string to a set of Unicode argument strings (WinNT only)
How to delete IE cookies, clear IE history and delete files in Temporary Internet Files directory
How to find which fonts Windows uses for drawing captions, menus and message boxes
How to suspend or hibernate your system
Moving shortcut to a specified position on the Windows Desktop
Simple Window Viewer
Starting a dialog box for connecting to network resources (mapping network drive)
Using custom Simple MapiSendMail class
Converting an integer value to a hexadecimal string
GDI+: rotating images using matrix transformations
Printing text on the main VFP window
Reading the structure of VFP main menu
A class that encrypts and decrypts files using Cryptography API Functions

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
Versions:
click to open
Before you begin:
The EncryptDecrypt class uses several Cryptography API Functions to implement password-protected encryption and decryption of files.


Do you think there are some similarities?


Here is an example of code that encrypts a file:
LOCAL oEnc As EncryptDecrypt
oEnc = CREATEOBJECT("EncryptDecrypt")

WITH oEnc
        IF NOT .GenerateKey("foxpro") && a password
                ? .errorno, .errormessage
        ELSE
                IF NOT .EncryptFile("c:\myfiles\somefile.txt",;
                        "c:\myfiles\somefile.enc")
                        ? .errorno, .errormessage
                ENDIF
        ENDIF
ENDWITH

The decryption is same simple:
WITH oEnc
        IF NOT .GenerateKey("foxpro") && use same password
                ? .errorno, .errormessage
        ELSE
                IF NOT .DecryptFile("c:\myfiles\somefile.enc",;
                        "c:\myfiles\somefile.enc.txt")
                        ? .errorno, .errormessage
                ENDIF
        ENDIF
ENDWITH

See also:
  • How to create MD-5 and SHA-1 hash values from a string
  • CryptoAPI: Collection of Providers class

  •  
      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:
    • ~
    5981 bytes  
    Created: 2006-04-21 18:35:08  
    Modified: 2011-12-10 09:20:22  
    Visits in 7 days: 94  
    Listed functions:
    CryptAcquireContext
    CryptCreateHash
    CryptDecrypt
    CryptDeriveKey
    CryptDestroyHash
    CryptDestroyKey
    CryptEncrypt
    CryptHashData
    CryptReleaseContext
    GetLastError
    Printer friendly API declarations
    My comment:
    Default cryptographic service provider (CSP) is used along with algorithms CALG_MD5 for hashing and CALG_RC4 for encryption/decryption.

    Before encrypting or decrypting files, user must provide a password using the GenerateKey method of the class. A cryptographic session key is created from the hash of this password.

    A file is processed as a single block.

    * * *
    Oct.29, 2008: the EncryptBuffer method now allocates correct buffer size in cases when encrypted data is larger than the original plain text.
    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.242.233.11)
    26.27 min.Function: 'SQLAllocHandle'
    Function group: 'ODBC API'
    26.32 min.Example: 'Using custom Simple MapiSendMail class'
    26.37 min.Function: 'FindCloseChangeNotification'
    54.97 min.Example: 'GDI+: sending image of FoxPro form to printer'
    55.02 min.Function: 'mmioOpen'
    Function group: 'Windows Multimedia'
    55.07 min.
    1.37 hrs.Example: 'How to print FoxPro form'
     Example: 'Encapsulating access to the Windows Services in a class'
    Google
    Advertise here!