Tips Forum Logo
Tips Forum Home PageSpacerVisit Microsoft Knowledge BaseMAUG Home PageMAUG Russian Home Page

Как получить MS Access 97 ProductID
How to read License Key of MS Access 97

Applies to: Access 97


'*+
' Feel free to use this piece of code but please don't delete this header.
'
' Purpose: Read License Key of Acc97 given its exe fullpath.
' Author: Shamil Salakhetdinov, e-mail: shamil@marta.darts.spb.ru
' Written at: 24.02.99 23:47:18 St.Petersburg (Russia) Mean Time
'
' Note:
'
' Tested with MS Office 97 Pro English (USA) version and German(Standard)
' version no service packs installed
'
' Usage:
'
' GetAcc97LicKey("C:\Program Files\Microsoft Office\Office\msaccess.exe")
'*+

Private Const cstrSignature As String = _
"53 00 74 00 72 00 69 00 6E 00 67 00 46 00 " & _
"69 00 6C 00 65 00 49 00 6E 00 66 00 6F 00 "

Public Function GetAcc97LicKey(ByVal vstrAcc97FullPath As String)
Const clngRecLen As Long = 32767

Dim intFn As Integer
Dim strInBuf As String * clngRecLen
Dim lngOffSet As Long
Dim lngPos As Long
Dim strSign As String
Dim i As Integer
Dim lngLOF As Long

For i = 1 To Len(cstrSignature) Step 3
strSign = strSign & Chr("&h" & Mid(cstrSignature, i, 2))
Next i

intFn = FreeFile
Open vstrAcc97FullPath For Binary Access Read As #intFn

lngLOF = LOF(intFn)

Do While (1)
Get #intFn, , strInBuf

lngPos = InStr(1, strInBuf, strSign)

If lngPos <> 0 Then Exit Do
If lngOffSet + clngRecLen > lngLOF Then Exit Do

lngOffSet = lngOffSet + clngRecLen
Seek #intFn, lngOffSet
strInBuf = ""
Loop


If lngPos <> 0 Then
Seek #intFn, lngOffSet + lngPos - 1 + 704 + 172 - 18
Get #intFn, , strInBuf
GetAcc97LicKey = Left(strInBuf, 20)
End If

Close #intFn

End Function

From  Shamil Salakhetdinov , Entry Date 01.03.99



Microsoft Access Solutions

Written and designed by
Alex Dybenko
Send us your comments
Last Update: 2007-10-15
Copyright © 1998-2007 by MAUG

Alex & Access