Using Win32 functions in Visual FoxPro Image Gallery
Dynamic-Link Library
..msdn
FreeLibrary
GetModuleFileName
GetModuleHandle
GetProcAddress
LoadLibrary
LoadLibraryEx
Code examples:
Retrieving a handle to DLL and address of an exported function in it
Retrieving a handle to DLL and address of an exported function in it

User rating: 10/10 (1 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 lcModule, lcProc, lcSysDir, hModule, lnAddr
lcModule = "kernel32.dll"
lcProc = "GetTickCount"
lcSysDir = GetSysDir()
 
hModule = GetModuleHandle(lcSysDir + CHR(92) + lcModule)
lnAddr = GetProcAddress(hModule, lcProc)
 
IF lnAddr = 0
    ? "Error code:", GetLastError()
ELSE
    ? "Address of " + lcProc + " in " + lcModule + ":",;
        "0x"+int2hex(lnAddr)
ENDIF
 
FUNCTION GetSysDir
    LOCAL lpBuffer, lnSize
    lpBuffer = SPACE (250) 
    lnSize = GetSystemDirectory (@lpBuffer, Len(lpBuffer)) 
RETURN LEFT(lpBuffer, lnSize)
 
FUNCTION int2hex(num)
    LOCAL lnResult, lcResult
    lcResult = SPACE(20)
    lnResult = wnsprintf(@lcResult, 20, "%x", num)
RETURN LEFT(lcResult, lnResult)
 
PROCEDURE declare
    DECLARE INTEGER GetLastError IN kernel32
    DECLARE INTEGER GetModuleHandle IN kernel32 STRING lpModule
 
    DECLARE INTEGER GetProcAddress IN kernel32;
        INTEGER hModule, STRING lpPrcName
 
    DECLARE INTEGER GetSystemDirectory IN kernel32; 
        STRING @lpBuffer, INTEGER nSize 
 
    DECLARE INTEGER wnsprintf IN Shlwapi;
        STRING @lpOut, INTEGER cchLimitIn,;
        STRING pszFmt, INTEGER
 
 
 

User rating: 10/10 (1 votes)
Rate this code sample:
  • ~
1115 bytes  
Created: 2001-08-03 12:00:00  
Modified: 2006-03-14 10:46:01  
Visits in 7 days: 58  
Listed functions:
GetLastError
GetModuleHandle
GetProcAddress
GetSystemDirectory
wnsprintf
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.234.126.92)
1.28 hrs.Example: 'How to copy the image of a form to the Clipboard using Bitmap API functions'
 Function: 'DocumentProperties'
5.41 hrs.Function: 'DrawEdge'
Function group: 'Painting and Drawing'
9.93 hrs.Function: 'CreateCompatibleDC'
 Example: 'Using Change Notification Objects to monitor changes to the printer or print server'
12.55 hrs.Function: 'DeviceIoControl'
 Example: 'Transparent Menu Class (requires VFP9)'
 Example: 'Setting the Window Region for a form'
16.74 hrs.Example: 'Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)'
 Function: 'GdipGetPageScale'
Function group: 'GDI+ Graphics'
Google
Advertise here!