Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Network Card Address
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00271688
Message ID:
00271854
Views:
28
>Is there any API call which will return the address of a network card? The winipcfg.exe app (comes with win95/98) does return the address of a network card. I need to access this address thru VFP or VC.

This code is from the "RodMan"

*From http://www.Dashpoint.com - Rod Paddock.
* a function to give a unique id.
* Twelve characters to the right are NIC address.
ox=getuuid()
? ox

Function getUUID
*-- The UUID Create function is in this library
* Do a find on RPCRT4.DLL
*
DECLARE Integer UuidCreate IN d:\Winnt\System32\RPCRT4.DLL ;
String @ UUID && note that mixed case is important for UuidCreate

*-- Create a buffer
lcUUID = Space(16)
*-- generate the key
=UUIDCreate(@lcUUID)
*-- Convert the binaries to hex values
lcPart1 = BinAsHex(Substr(lcUUID,1,4))
lcPart2 = BinAsHex(Substr(lcUUID,5,4))
lcPart3 = BinAsHex(Substr(lcUUID,8,4))
lcPart4 = BinAsHex(Substr(lcUUID,13,4))

Local lcRetVal
lcRetVal = lcPart1 + lcPart2 + lcPart3 + lcPart4
Return Left(lcRetVal,8) + "-" + substr(lcRetVal,9,4) + "-" + substr(lcRetVal,13,4) + "-" + ;
substr(lcRetVal,17,4) + "-" + Right(lcRetVal,12)

PROCEDURE binashex
Parameters lcBin
* translates a binary string into character string of hex
LOCAL lcChars, lnBin

lcChars = ""
FOR lnDigit = 1 TO LEN(lcBin)
lnBin = ASC(SUBSTR(lcBin, lnDigit, 1))
lcChars = lcChars + Hex2Char(INT(lnBin/16)) + ;
Hex2Char(MOD(lnBin,16))
ENDFOR

RETURN(lcChars)

PROCEDURE hex2char
* takes a hex digit value and returns a character from 0-9 & A-F
LPARAMETERS lnHex
DO CASE
CASE BETWEEN(lnHex,0,9) && 0-9 maps to numbers where asc 48 = '0'
lnAsc = 48 + lnHex
CASE BETWEEN(lnHex,10,15) && 10-15 maps to letters where asc 65 = 'A'
lnAsc = 65 + lnHex - 10
ENDCASE
RETURN(CHR(lnAsc))
John Harvey
Shelbynet.com

"I'm addicted to placebos. I could quit, but it wouldn't matter." Stephen Wright
Previous
Reply
Map
View

Click here to load this message in the networking platform