Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Retrieving statistics for the TCP protocol running on the local computer
Creating a file, then moving it to another destination
GDI+: enumerating fonts installed on the system
Converting characters to upper or lower case
Retrieving the System Time adjustment
Searching for the specified file using the SearchPath
Listing device drivers in the system: load addresses, names
Obtaining window class name for the main VFP window
CryptoAPI: retrieving list of providers
GDI+: loading image file, drawing on it, saving the result to another file
Joining local computer to a domain (XP/2000)
Retrieving national language settings
Retrieving the path of the printer-driver directory and printer-processor directory
Enumerating Performance Counters
Finding the application, icon and friendly names associated with a file name
How to access a file using not its name but an alias (hard link)
Obtaining the System and Windows folder names
PocketPC: creating directories and files
Using GetCompressedFileSize (WinNT only)
Retrieving default spooling directory name
Setting the last-error code for the FoxPro
Using ActiveX control for adding a menu directly to a FoxPro MDI form
Displaying the color palette stored in an image file
How to fill a buffer with random bytes using Cryptography API Functions
Listing device drivers in the system: load addresses, names

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
 
DO declare
 
LOCAL lcBuffer, lnAllocated, lnBytesNeeded, ii,;
    lnLoadAddr, lcBaseName, lcFullName
 
lnBytesNeeded = 0
 
* MSDN: 
* It is a good idea to give EnumDeviceDrivers a large array 
* of LPVOID values, because it is hard to predict 
* how many device drivers there will be at the time 
* you call EnumDeviceDrivers. 
 
lnAllocated = 16384
lcBuffer = Repli(Chr(0), lnAllocated)
 
IF EnumDeviceDrivers(@lcBuffer, lnAllocated, @lnBytesNeeded) <> 0
    lcBuffer = Left(lcBuffer, lnBytesNeeded)
 
    * resulting cursor
    CREATE CURSOR csResult (drivername C(30),;
        loadaddr N(12), fullname C(250))
 
    FOR ii=1 TO lnBytesNeeded/4
        lnLoadAddr = buf2dword(SUBSTR(lcBuffer, (ii-1)*4+1, 4))
 
        * retrieving the base name
        lcBaseName = SPACE(50)
        = GetDeviceDriverBaseName(lnLoadAddr,;
            @lcBaseName, Len(lcBaseName))
        lcBaseName = Left(lcBaseName, AT(Chr(0),lcBaseName)-1)
 
        * retrieving the fully qualified path for the driver
        lcFullName = SPACE(250)
        = GetDeviceDriverFileName(lnLoadAddr,;
            @lcFullName, Len(lcFullName))
        lcFullName = Left(lcFullName, AT(Chr(0),lcFullName)-1)
 
        INSERT INTO csResult VALUES (;
            lcBaseName, lnLoadAddr, lcFullName)
    ENDFOR
 
    GO TOP
    BROW NORMAL NOWAIT
ENDIF
 
FUNCTION buf2dword(lcBuffer)
RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ;
    Asc(SUBSTR(lcBuffer, 2,1)) * 256 +;
    Asc(SUBSTR(lcBuffer, 3,1)) * 65536 +;
    Asc(SUBSTR(lcBuffer, 4,1)) * 16777216
 
PROCEDURE declare
    DECLARE INTEGER EnumDeviceDrivers IN psapi;
        STRING @lpImageBase, INTEGER cb, INTEGER @lpcbNeeded
 
    DECLARE INTEGER GetDeviceDriverBaseName IN psapi;
        INTEGER ImageBase, STRING @lpBaseName, INTEGER nSize
 
    DECLARE INTEGER GetDeviceDriverFileName IN psapi;
        INTEGER ImageBase, STRING @lpFilename, INTEGER nSize
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1771 bytes  
Created: 2001-10-25 21:11:38  
Modified: 2010-08-13 20:16:46  
Visits in 7 days: 41  
Listed functions:
EnumDeviceDrivers
GetDeviceDriverBaseName
GetDeviceDriverFileName
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.76.170)
4 sec.Function: 'SQLDataSources'
Function group: 'ODBC API'
5.37 hrs.Example: 'Detecting changes in connections to removable drives (VFP9)'
5.83 hrs.Function: 'GetClipboardOwner'
 Function: 'JetCommitTransaction'
6.53 hrs.Example: 'How to play MIDI notes'
 Function: 'StartService'
8.76 hrs.Example: 'How to suspend or hibernate your system'
 
Function group: 'Filled Shape'
10.14 hrs.Example: 'Locking the workstation'
 Function: 'SetSysColors'
Function group: 'System Information'
Google
Advertise here!