Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Winsock: retrieving information from a host database for a given host name
Building a tree of subdirectories for a given path using FindFile functions
Closing Windows
Retrieving a handle to DLL and address of an exported function in it
Retrieving long values associated with the class of the VFP window
Using LoadLibrary
Using the heap of the calling process to allocate memory blocks
Who owns the Windows Clipboard
Obtaining heap handles and enumerating memory blocks for the current VFP session (WinNT only)
Obtaining the System and Windows folder names
Enumerating connections made to a shared resource for the local computer (WinNT only)
Memory usage info for current VFP session (WinNT only)
One more way to retrieve environment strings
Pocket PC: System Registry Viewer
Reading Internet Query options
Retrieving information about all users currently logged on to the workstation (WinNT only)
Saying "Hello World!" with VFP and WinAPI
How to write and read Window Properties for the specified window
GDI+: enumerating fonts installed on the system
Using the GetLogicalDriveStrings
How to play a waveform sound (a WAV file in particular)
Determining whether or not the system is connected to the Internet
Reading keys in the specified section of the Win.ini file
Retrieving the priority class for the current process
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: 27  
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 (50.16.17.90)
13 min.Function: 'AVIStreamGetFrame'
13.05 min.Function: 'DrawIcon'
8.3 hrs.Function: 'waveOutGetPosition'
 Example: 'How to prevent users from accessing the Windows Desktop and from switching to other applications'
8.54 hrs.Example: 'Creating irregularly shaped FoxPro form using transparency color key'
10.55 hrs.Example: 'Setting and retrieving the double-click time for the mouse'
 Example: 'GDI+: retrieving list of available image encoders and image decoders'
11.69 hrs.Example: 'Pocket PC: custom RAPI class for operating with files and folders on mobile device'
 Function: 'HeapValidate'
14.6 hrs.Example: 'Testing serial ports'
Google
Advertise here!