Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Retrieving information about the main VFP window
Using the GetTempFileName
Using vendor-neutral SQL constructs
Verifying a file using the Authenticode policy provider
A procedure for setting file times
Comparing dimensions of the VFP main window with _SCREEN properties
Copying strings through the global memory block
Finding the path to the VFP executable running
How to download this reference`s archive through WinInet functions using InternetOpenUrl
How to view system icons for the classes installed on the local machine
Obtaining physical parameters for a drive: sectors, clusters, cylinders...
Obtaining Shell32.dll version
Retrieving the name of the primary domain controller (PDC) and join status information (NT/2000/XP)
Enumerating ODBC Data Sources available on the local computer
GDI+: Color Transparency
GDI+: Storing DLL icon resources in image files
Obtaining heap handles and enumerating memory blocks for the current VFP session (WinNT only)
Obtaining I/O counts for the current process
Obtaining OS memory performance information
Returning some basic information for the specified INF file
Current keyboard type
Enumerating MIDI output devices
Pocket PC: Folder Viewer
Starting a dialog box for connecting to network resources and passing input parameters
CryptoAPI: retrieving list of providers

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:
The code is based on Collection of CryptoAPI Providers class. Download the class module first and save it in crypto.prg file.



See also:
  • Simple class that encrypts and decrypts files using Cryptography API Functions
  • How to create MD-5 and SHA-1 hash values from a string

  •  
    SET PROCEDURE TO crypto ADDITIVE
     
    LOCAL oForm
    oForm = CREATEOBJECT("Tform")
    oForm.Show(1)
    * end of main
     
    DEFINE CLASS Tform As Form
    #define PP_VERSION              5
    #define PP_IMPTYPE              3
    #define PP_CONTAINER            6
    #define PP_PROVTYPE             16
    #define PP_SYM_KEYSIZE          19
    #define PP_KEYSET_TYPE          27
    #define PP_ADMIN_PIN            31
    #define PP_SIGNATURE_PIN        33
    #define PP_UNIQUE_CONTAINER     36
    #define PP_SGC_INFO             37
    PROTECTED providers, provider
        Width=500
        Height=330
        BorderStyle=2
        MaxButton=.F.
        MinButton=.F.
        Caption="Crypto API Providers"
        Autocenter=.T.
     
        ADD OBJECT lst As ListBox WITH Top=0, Left=0,;
        Width=500, Height=140
     
        ADD OBJECT params As ListBox WITH Top=150, Left=0,;
        Width=240, Height=70, ColumnCount=2, ColumnWidths="100,160"
     
        ADD OBJECT conts As ListBox WITH Top=224, Left=0,;
        Width=240, Height=70
     
        ADD OBJECT algs As ListBox WITH Top=150, Left=244,;
        Width=256, Height=144, ColumnCount=3, ColumnWidths="60,60,300"
     
        ADD OBJECT sbar As Tbar WITH Left=0, Height=21, Width=685
     
    PROCEDURE Init
        THIS.GetProviders
     
    PROCEDURE lst.InteractiveChange
        ThisForm.ShowProvider
     
    PROCEDURE ShowProvider
    #DEFINE SCARD_E_NO_SERVICE 0x8010001D
    #DEFINE NTE_BAD_ALGID 0x80090008
        LOCAL cProvider
        cProvider = THIS.lst.Value
        THIS.provider = Null
        THIS.provider = THIS.providers.GetProvider(m.cProvider)
        THIS.provider.AcquireContext()  && default container
     
        IF THIS.provider.context <> 0
            THIS.sbar.Panels(1).Text = "context: " +;
                TRANSFORM(THIS.provider.context)
        ELSE
            THIS.sbar.Panels(1).Text = "error: " +;
                TRANSFORM(THIS.provider.errorcode, "@0")
        ENDIF
     
        THIS.ShowParameters
        THIS.ShowContainers
        THIS.ShowAlgorithms
     
    PROTECTED PROCEDURE GetProviders
        THIS.lst.Clear
        LOCAL provider
        THIS.providers = CREATEOBJECT("providers")
        FOR EACH provider IN THIS.providers
            THIS.lst.AddItem(provider.provname)
        ENDFOR
        WITH THIS.lst
            .ListIndex=1
            .InteractiveChange
        ENDWITH
     
    PROCEDURE ShowAlgorithms
        THIS.algs.Clear
        LOCAL oAlg
        FOR EACH oAlg IN THIS.provider.algorithms
            WITH THIS.algs
                .AddItem(TRANSFORM(oAlg.algid))
                .List(.ListCount, 2) = TRANSFORM(oAlg.bitlen)
                .List(.ListCount, 3) = oAlg.algname
            ENDWITH
        ENDFOR
     
    PROCEDURE ShowContainers
        THIS.conts.Clear
        LOCAL oCont
        FOR EACH oCont IN THIS.provider.keycontainers
            THIS.conts.AddItem(oCont.containername)
        ENDFOR
     
    PROCEDURE ShowParameters
        THIS.params.Clear
        THIS.ShowParameter("Implement.", PP_IMPTYPE, "N")
        THIS.ShowParameter("Version", PP_VERSION, "N")
        THIS.ShowParameter("Container", PP_CONTAINER)
        THIS.ShowParameter("Type", PP_PROVTYPE, "N")
        THIS.ShowParameter("Unique cont.", PP_UNIQUE_CONTAINER)
     
    PROTECTED PROCEDURE ShowParameter(cName, nId, cType)
        LOCAL vValue
        vValue = THIS.provider.GetProvParam(nId, cType)
        WITH THIS.params
            .AddItem(cName)
            .List(.ListCount,2) = " "+TRANSFORM(m.vValue)
        ENDWITH
    ENDDEFINE
     
    DEFINE CLASS Tbar As OleControl
        OleClass="MSComctlLib.SBarCtrl.2"
    PROCEDURE Init
        THIS.Height=21
        THIS.Panels.Add()
        THIS.Panels.Add()
        THIS.Panels(1).Width = 140
        THIS.Panels(2).Width = 120
        THIS.Panels(3).Width = 400
    ENDDEFINE
     
     
     

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    3242 bytes  
    Created: 2004-08-05 15:52:02  
    Modified: 2006-05-08 18:33:23  
    Visits in 7 days: 76  
    Listed functions:
    Printer friendly API declarations
    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.7.65)
    5 sec.Function: 'GdipDisposeImage'
    Function group: 'GDI+ Image'
    8 sec.Function: 'SQLInstallerError'
    Function group: 'ODBC API'
    2.13 hrs.Example: 'How to copy the image of a form to the Clipboard using Bitmap API functions'
     Function: 'SHCreateDirectory'
    Function group: 'Shell Functions'
     Example: 'How to make a VFP form fading out when released (GDI version)'
    4.35 hrs.Example: 'How to display a user-defined icon in the MessageBox dialog'
     Example: 'Setting the date and time that a file was created'
     Function: 'GdipGetMatrixElements'
    Function group: 'GDI+ Matrix'
    5.01 hrs.Function: 'CeDeleteRecord'
    Function group: 'Remote Application Programming (RAPI)'
     Function: 'GetWindowLong'
    Function group: 'Window Class'
    Google
    Advertise here!