#1   Report Post  
Posted to microsoft.public.excel.programming
sgl sgl is offline
external usenet poster
 
Posts: 80
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
sgl sgl is offline
external usenet poster
 
Posts: 80
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setup Ganesh Kumar[_2_] Excel Programming 2 July 21st 09 05:31 PM
Changes in my setup? Mike Rogers[_2_] Excel Discussion (Misc queries) 3 November 11th 07 05:47 PM
Setup cmorga20 Excel Discussion (Misc queries) 1 July 13th 06 08:15 PM
setup Bonzo Excel Worksheet Functions 2 March 26th 05 01:10 PM
setup Aidan[_3_] Excel Programming 2 February 23rd 04 06:03 PM


All times are GMT +1. The time now is 06:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"