Series number of inventor

Series number of inventor

Anonymous
Not applicable
564 Views
8 Replies
Message 1 of 9

Series number of inventor

Anonymous
Not applicable
Is there method which get series number of Inventor.

Zorba29
0 Likes
565 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
Yes, it should be in
HKEY_LOCAL_MACHINE/software/autodesk/Inventor/Registryversion11.0/serialNumber

I assume you have IV11

--
CVAengineering At Gmail Dot com (Replace At with @, Dot with .)

IV11 Pro. sp2
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 84.26
SpacePilot V 1.1.2
wrote in message news:5516512@discussion.autodesk.com...
Is there method which get series number of Inventor.

Zorba29
0 Likes
Message 3 of 9

Anonymous
Not applicable
Good to hear it.
How can I use this method in VBA

I you know, please help me.
0 Likes
Message 4 of 9

Anonymous
Not applicable
Unless you know what you're doing, I don't recommend you mess around with
registry
You can google read and write registry
Chris

--
CVAengineering At Gmail Dot com (Replace At with @, Dot with .)

IV11 Pro. sp2
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 84.26
SpacePilot V 1.1.2
wrote in message news:5517085@discussion.autodesk.com...
Good to hear it.
How can I use this method in VBA

I you know, please help me.
0 Likes
Message 5 of 9

Anonymous
Not applicable
I need only read series number of Inventor by VBA for check of authorization

I don't want to change registry, but only read by VBA.
0 Likes
Message 6 of 9

Anonymous
Not applicable
When you say VBA, I assume you mean you're writing .ivb (macro) - not sure
if the win window AIP read/write registry works in VBA
I only use it on my VB programs.
hereis the code. Pass the path I provide in the earlier msg to GetRegString
function
and user an if statement to veryfy the serial number
Good luck, Chris


Enum RegHive
HKEY_CLASSES_ROOT = &H80000000
HK_CR = &H80000000
HKEY_CURRENT_USER = &H80000001
HK_CU = &H80000001
HKEY_LOCAL_MACHINE = &H80000002
HK_LM = &H80000002
HKEY_USERS = &H80000003
HK_US = &H80000003
HKEY_CURRENT_CONFIG = &H80000005
HK_CC = &H80000005
HKEY_DYN_DATA = &H80000006
HK_DD = &H80000006
End Enum

Enum RegType
REG_SZ = 1 'Unicode nul terminated string
REG_BINARY = 3 'Free form binary
REG_DWORD = 4 '32-bit number
End Enum

Public Const ERROR_SUCCESS = 0&
Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long)
As Long
Public Declare Function RegCreateKey Lib "advapi32.dll" Alias
"RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As
Long) As Long
Public Declare Function RegDeleteKey Lib "advapi32.dll" Alias
"RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Public Declare Function RegDeleteValue Lib "advapi32.dll" Alias
"RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA"
(ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Public Declare Function RegQueryValueEx Lib "advapi32.dll" Alias
"RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal
lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias
"RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal
Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long)
As Long
Public Declare Function RegEnumKey Lib "advapi32.dll" Alias "RegEnumKeyA"
(ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, ByVal
cbName As Long) As Long

Public Function GetRegString(hKey As RegHive, strPath As String, strValue As
String, Optional Default As String) As String
Dim hCurKey As Long
Dim lResult As Long
Dim lValueType As Long
Dim strBuffer As String
Dim lDataBufferSize As Long
Dim intZeroPos As Integer
Dim lRegResult As Long
'Set up default value
If Not IsEmpty(Default) Then
GetRegString = Default
Else
GetRegString = ""
End If
lRegResult = RegOpenKey(hKey, strPath, hCurKey)
lRegResult = RegQueryValueEx(hCurKey, strValue, 0&, lValueType, ByVal
0&, lDataBufferSize)
If lRegResult = ERROR_SUCCESS Then
If lValueType = REG_SZ Then
strBuffer = String(lDataBufferSize, " ")
lResult = RegQueryValueEx(hCurKey, strValue, 0&, 0&, ByVal
strBuffer, lDataBufferSize)
intZeroPos = InStr(strBuffer, Chr$(0))
If intZeroPos > 0 Then
GetRegString = Left$(strBuffer, intZeroPos - 1)
Else
GetRegString = strBuffer
End If
End If
Else
'there is a problem
End If
lRegResult = RegCloseKey(hCurKey)
End Function

--
CVAengineering At Gmail Dot com (Replace At with @, Dot with .)

IV11 Pro. sp2
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 84.26
SpacePilot V 1.1.2
wrote in message news:5517254@discussion.autodesk.com...
I need only read series number of Inventor by VBA for check of authorization

I don't want to change registry, but only read by VBA.
0 Likes
Message 7 of 9

Anonymous
Not applicable
VBA doesn't directly support general access to the registry. However, it is
possible to do this using the Windows API. As was previously suggested, you
can find information about doing this by using Google.

There are some unsupported routines available through the Inventor API to
access the registry. These are not supported because you need to be very
careful when working with the registry and any repurcusions are your
responsibility. Here's an example of how to use it to get the value you
want.

Dim value As Variant
value = ThisApplication.[_RegistryEntry]("", "SerialNumber",
kInventorHiveLM)

--
Brian Ekins
Autodesk Inventor API

wrote in message news:5517254@discussion.autodesk.com...
I need only read series number of Inventor by VBA for check of authorization

I don't want to change registry, but only read by VBA.
0 Likes
Message 8 of 9

Anonymous
Not applicable
Thank you so much

It is very important for me.
0 Likes
Message 9 of 9

MattH_Work
Collaborator
Collaborator
Using the following to retrieve the SN works well

Dim value As Variant
value = ThisApplication.[_RegistryEntry]("", "SerialNumber",
kInventorHiveLM)

Except where the software was installed with 000-00000000 (and changed at a later date)
It seems the registry is only written at install and NOT updated when the user enters a 'real' serial number, therefore the code above still pulls in a 000-00000000 number!!!

Regards

MattH

MattH
Product Design Collection 2026
Vault Pro 2026
0 Likes