setup.exe

S

sgl

Hi All,

I have developed a Dictator application in excel that will be distributed to
various branches of the company. I have used SetUp Factory 8 to package the
application. As the application is loaded I have placed a registry value in
the Windows Registry HKEY_LOCAL_MACHINE etc etc.

To restrict copying of the Excel application when the program is opened by
the user the Auto_Open routine checks that the registry value (placed in
HKEY_LOCAL_MACHINE) agrees with the "registration" value of the program. If
the two agree then the program will open otherwise the user is notified
accordingly.

My problem is if the system administrator loads the Excel application on the
company's "server" how can I get my program to check the values which are
placed not on the users computer but on the "server machine".

Any assistance would be appreciated/sgl
 
J

john

just an idea - what about checking the name of the machine your application
is running on? - if its the server, then code to take whatever action
required.

code (not mine but authour unknown) like following may help - goes in
standard module

Private Declare Function GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long


Function GetName() As String
Dim rString As String * 255, sLen As Long, tString As String
tString = ""
On Error Resume Next
sLen = GetComputerName(rString, 255)
sLen = InStr(1, rString, Chr(0))
If sLen > 0 Then
tString = Left(rString, sLen - 1)
Else
tString = rString
End If
On Error GoTo 0
GetName = UCase(Trim(tString))
End Function



Sub GetDesktopName()

MsgBox GetName

End Sub
 
S

sgl

Thank you John for your prompt reply,

I have adapted/played around with the following Function from JWalk Excel
2002 VBA Power Programming book

Function GetRegistryId2()
Dim RootKey As String
Dim path As String
Dim RegEntry As String
Dim strKeyCheck

RootKey = "HKEY_LOCAL_MACHINE"
path = "Software\\MyApplication"
RegEntry = "MyTitle"
strKeyCheck = GetRegistry(RootKey, path, RegEntry)

GetRegistryId2 = strKeyCheck

End Function

Sub test2()
Dim strKeyCheck

strKeyCheck = GetRegistryId2
MsgBox strKeyCheck

End Sub

This gets the results that I need and works well on my PC. However, what I
cannot understand and have not been able to check is what the RootKey =
"HKEY_LOCAL_MACHINE" variable is reading once the program is loaded onto the
server and is opened from a network PC. Does HKEY_LOCAL_MACHINE refer to the
PC or to the Server machine?

I thought of using the GetComputerName API but this gives me the computer
name but not the complete path where the registraton is stored as in the
above function.

Am I misunderstanding something???/sgl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top