ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   setup.exe (https://www.excelbanter.com/excel-programming/432307-setup-exe.html)

sgl

setup.exe
 
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

John

setup.exe
 
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
--
jb


"sgl" wrote:

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


sgl

setup.exe
 
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


"john" wrote:

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
--
jb


"sgl" wrote:

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



All times are GMT +1. The time now is 10:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com