Using Win32 functions in Visual FoxPro Image Gallery
Performance Monitoring
..msdn
CreateToolhelp32Snapshot
EnumDeviceDrivers
EnumProcesses
EnumProcessModules
GetDeviceDriverBaseName
GetDeviceDriverFileName
GetModuleBaseName
GetModuleFileNameEx
GetPerformanceInfo
GetProcessMemoryInfo
Process32First
Process32Next
Code examples:
Listing device drivers in the system: load addresses, names
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: 29  
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 (54.224.79.93)
3 sec.Function: 'CryptGetProvParam'
3.73 hrs.Example: 'How to display a Task Dialog (Vista)'
 Solution: 'ContextMenu ActiveX Control'
4.42 hrs.Function: 'CryptAcquireContext'
6.05 hrs.Function: 'waveOutPrepareHeader'
 Example: 'Simple printer queue monitor: deletes, pauses, resumes print jobs for local printer'
11.24 hrs.Function: 'OpenEvent'
 Example: 'Reading and setting explicit Application User Model ID for the current process (Win7)'
17.5 hrs.Example: 'Current keyboard type'
 Example: 'Using the ChooseColor function'
Google
Advertise here!