Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Retrieving long values associated with the class of the VFP window
Changing file attributes
Finding parameters for the region specified
Retrieving current user for the process
Retrieving graphic capabilities of your display
Retrieving national language settings
Using IsChild() for testing ThisForm.ShowWindow property
Copying files as a transacted operation (Vista)
Extended OS Version info
Converting strings between ANSI and OEM
Obtaining the System and Windows folder names
Obtaining window class name for the main VFP window
Pocket PC: modifying keys in the System Registry
PocketPC: creating directories and files
StrDup returns a pointer to the duplicate of a source VFP string
Validating the heap of the calling process
Displaying all TCP connections for the local system
How to delete a service object
URL: converting unsafe characters and spaces into escape sequences
How to check whether the system is 32-bit or 64-bit
Retrieving the path of the printer-driver directory and printer-processor directory
Displaying the color palette stored in an image file
Joining local computer to a domain (XP/2000)
List of ODBC drivers installed (read from the [ODBC Drivers] section)
Retrieving country-specific dialing information from the Windows Telephony list of countries

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 RasGetCountryInfo IN rasapi32;
    STRING @lpRasCtryInfo, INTEGER @lpdwSize
 
*|typedef struct RASCTRYINFO {
*|  DWORD   dwSize;                0:4
*|  DWORD   dwCountryID;           4:4
*|  DWORD   dwNextCountryID;       8:4
*|  DWORD   dwCountryCode;        12:4
*|  DWORD   dwCountryNameOffset;  16:4
*|} RASCTRYINFO; total bytes = 20
#DEFINE RASCTRYINFO_SIZE  20
 
CREATE CURSOR csResult (countryId N(12), countryCode N(12),;
    countryName C(50))
 
PRIVATE pnIndex
pnIndex = 1
 
DO WHILE GetCountryInfo()
ENDDO
 
WAIT CLEAR
GO TOP
BROWSE NORMAL NOWAIT
* end of main
 
PROCEDURE GetCountryInfo()
    LOCAL lcBuffer, lnBufsize, lnResult
 
    lcBuffer = num2dword(RASCTRYINFO_SIZE) +;
        num2dword(pnIndex) + Repli(Chr(0), 12)
    lnBufsize = 0
 
    * first call with insufficient buffer size
    * returns required buffer size
    = RasGetCountryInfo(@lcBuffer, @lnBufsize)
 
    * real call
    lcBuffer = PADR(lcBuffer, lnBufsize, Chr(0))
    lnResult = RasGetCountryInfo(@lcBuffer, @lnBufsize)
 
    IF lnResult <> 0
        RETURN .F.
    ENDIF
 
    LOCAL lnId, lnCode, lnOffset, lcName
    pnIndex = buf2dword(SUBSTR(lcBuffer, 9,4))
    IF pnIndex = 0
    * the list is over
        RETURN .F.
    ENDIF
 
    lnId = buf2dword(SUBSTR(lcBuffer, 5,4))
    lnCode = buf2dword(SUBSTR(lcBuffer, 13,4))
    lnOffset = buf2dword(SUBSTR(lcBuffer, 17,4))
    lcName = STRTRAN(SUBSTR(lcBuffer, lnOffset+1), Chr(0),"")
    WAIT WINDOW lcName NOWAIT
 
    INSERT INTO csResult VALUES (m.lnId, m.lnCode, m.lcName)
RETURN .T.
 
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)
 
FUNCTION  buf2dword (lcBuffer)
RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ;
    BitLShift(Asc(SUBSTR(lcBuffer, 2,1)),  8) +;
    BitLShift(Asc(SUBSTR(lcBuffer, 3,1)), 16) +;
    BitLShift(Asc(SUBSTR(lcBuffer, 4,1)), 24)
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1997 bytes  
Created: 2002-08-12 09:56:10  
Modified: 2002-08-12 09:57:46  
Visits in 7 days: 67  
Listed functions:
RasGetCountryInfo
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.129.212)
3 sec.Example: 'Retrieving information about the main VFP window'
23.27 min.Function: 'GetKeyState'
Function group: 'Keyboard Input'
23.32 min.Example: 'Retrieving a universal form for the drive-based path for a network resource'
12.11 hrs.Example: 'MapiSendMail class for Visual FoxPro application'
 Example: 'How to drag a Form not using its Titlebar or Caption'
21.69 hrs.Example: 'Custom GDI+ class'
 Example: 'Adding and deleting Scheduled Tasks using NetScheduleJob API functions'
Google
Advertise here!