Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to change the character to a numeric value in the variable

Status
Not open for further replies.

jezky82

MIS
Jul 7, 2012
39
0
0
ID
I have to get with the command lan mac addres
cMacAddress = ""
objWMIService = GetObject ("winmgmts:" +;
"{impersonationLevel = impersonate}! \ \. \ root \ cimv2")
colItems = objWMIService.ExecQuery (;
"Select * From Win32_NetworkAdapterConfiguration")
For Each objItem in colItems
IF varTYPE (objItem.MACAddress) = "C"
cMacAddress = cMacAddress objItem.MACAddress + + ","
endif
endfor
? cMacAddress
fixed value cMacAddress value is a character, how to change it to a numeric value. thank you...
I will use the formula mac serial number addres to my program

or is there another way to get the serial program that ever-changing change each install even if installed on the same cpu
 
Hex to decimal is done by EVAL("0x012345") for example, but why would you need this conversion to check against a registered MAC?

You question rather is about copy protection and licensing. The best way is a license server anyway and a third party product. See
Bye, Olaf.
 
I need a variable conversion mac addresses into numeric character for formulas that my software serial registers production
 
Well, does Eval work for you? Not?

Should I get more detailed? First of all your code has one obvious error in line cMacAddress = cMacAddress objItem.MACAddress + + "," - This is not a valid term, that should be cMacAddress = cMacAddress + objItem.MACAddress + "," - And besides that you have spaces in your getobject parameters, where they don't belong. Could you perhaps copy& paste the code you really use so far, giving you at least hexadecimal mac adresses?

Never mind, I figured it out.

Before you put all network adapter MAC adresses into one comma delmited list, you could convert each single Macadress into a number via the EVAL I gave in a sample cae, you just have to remove the : in the hex numbers, eval needs the pure hexadecimal digits (0-9 a-f) and prefix the whole hexadecimal string with 0x:

Code:
cMacAddress = ""
objWMIService = Getobject("winmgmts:{impersonationLevel = impersonate}!\\.\root\cimv2")
colItems = objWMIService.ExecQuery ("Select * From Win32_NetworkAdapterConfiguration")
For Each objItem In colItems
   If Vartype (objItem.MACAddress) = "C"
      ? Evaluate("0x"+Chrtran(objItem.MACAddress,":","")), "(="+objItem.MACAddress+")"
   Endif
Endfor

Bye, Olaf.

 
>I need a variable conversion mac addresses into numeric character for formulas that my software serial registers production

Actually I don't understand this. While I'm german that seems like an incomplete sentence, maybe from google translate?
MSDN forums has foxpro sections in many languages, just by the way.

If you have a software for software protection/licensing which needs you to specify a hardware specific number and can't determine it itself, that's another reason to use something else of another third party.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top