Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Setting and retrieving the double-click time for the mouse
Testing Transparent Menu Class with top-level form (requires VFP9)
Using the CopyFile
Basic Volume information
How to check whether the system is 32-bit or 64-bit
Retrieving various system metrics
Converting strings between ANSI and OEM
Current directory of the application
Retrieving current user for the process
Saying "Hello World!" with VFP and WinAPI
Using LoadLibrary
Winsock: retrieving the host information corresponding to a network address
Accessing the list of Windows Recent Documents
Converting characters to upper or lower case
Listing device drivers in the system: load addresses, names
Setting the Window Region for a form
GetFileOwner - Get the owner of an NTFS file
Managing Cookies
Retrieving the rectangle area where the mouse cursor is confined
Enumerating Performance Counters
How to create a service object
Retrieving national language settings
Creating two-byte hashes for a list of URLs
Finding the application, icon and friendly names associated with a file name
Retrieving the name and type of all available RAS-capable devices

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
 
DECLARE INTEGER RasEnumDevices IN rasapi32;
    STRING @lpRasDevInfo, INTEGER @lpcb, INTEGER @lpcDevices
 
#DEFINE RAS_MaxDeviceName  128
#DEFINE RAS_MaxDeviceType  16
 
* RASDEVINFO structure
*|typedef struct tagRASDEVINFO {
*|  DWORD    dwSize;                                 0:4
*|  TCHAR    szDeviceType[RAS_MaxDeviceType + 1];  4:17
*|  TCHAR    szDeviceName[RAS_MaxDeviceName + 1]; 21:128
*|} RASDEVINFO; total bytes = 150
 
LOCAL lcBuffer, lnBufsize, lnCount, lnResult, lnSubsize
STORE 0 TO lnBufsize, lnCount
 
* obtaining the size of the buffer that should be passed in
= RasEnumDevices(0, @lnBufsize, @lnCount)
IF lnCount = 0
    ? "No RAS Devices found."
    RETURN
ENDIF
 
lnSubsize = lnBufsize/lnCount && buffer size per device
lcBuffer = num2dword(lnSubsize) + Repli(Chr(0), lnBufsize-4)
 
lnResult = RasEnumDevices(@lcBuffer, @lnBufsize, @lnCount)
IF lnResult <> 0
* 603 = ERROR_BUFFER_TOO_SMALL
* 632
    ? "Error code:", lnResult
    RETURN
ENDIF
 
LOCAL lnIndex, lnOffset, lcSubstr, lcDevType, lcDevName
CREATE CURSOR csResult (idx N(5), devtype C(20), devname C(128))
 
FOR lnIndex=1 TO lnCount
    lnOffset = lnSubsize * (lnIndex-1) + 1
    lcSubstr = SUBSTR(lcBuffer, lnOffset, lnSubsize)
 
    lcDevType = STRTRAN(SUBSTR(lcSubstr, 5, 17), Chr(0),"")
    lcDevName = STRTRAN(SUBSTR(lcSubstr, 22, 128), Chr(0),"")
 
    INSERT INTO csResult VALUES (lnIndex, lcDevType, lcDevName)
ENDFOR
 
SELECT csResult
GO TOP
BROWSE NORMAL NOWAIT
 
FUNCTION  num2dword (lnValue)
#DEFINE m0       256
#DEFINE m1     65536
#DEFINE m2  16777216
    LOCAL b0, b1, b2, b3
    b3 = Int(lnValue/m2)
    b2 = Int((lnValue - b3*m2)/m1)
    b1 = Int((lnValue - b3*m2 - b2*m1)/m0)
    b0 = Mod(lnValue, m0)
RETURN Chr(b0)+Chr(b1)+Chr(b2)+Chr(b3)
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1746 bytes  
Created: 2002-08-10 23:30:31  
Modified: 2002-08-11 17:42:01  
Visits in 7 days: 80  
Listed functions:
RasEnumDevices
Printer friendly API declarations
My comment:
Allows to identify modem installed.
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
User Contributed Notes:
c.carter | 2006-06-08 12:27:40
Very useful. Even better if com port number was returned for enumerated modem types.

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.22.25.119)
27.75 min.Example: 'How to intercept window messages sent to VFP form'
1.03 hrs.Example: 'Drawing a rectangle using Windows regular edges and borders'
 Function: 'InternetDial'
Function group: 'Internet Functions (WinInet)'
Google
Advertise here!