Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Uniquely Identifying the LAN an application is running on

Status
Not open for further replies.

TomCarnahan

Programmer
Dec 7, 2002
123
US
I am looking for a technique to UNIQUELY identify the LAN my application is running on.

At work, we have two LANs. One LAN is running Windows 2000. The other is running Windows XP Pro. Both are running Office 2000. The application I built consists of one MS-Access file and one MS-Excel file that is manipulated by the Access file.

There was no reason to split the database or to use workgroup-level security, however, there are some features in the application that only a certain group of people need to see, while the average user does not. Application security is not an issue, but the features I mentioned are things that only an experienced user should see ... the novice would get themselves into problems if they started experimenting with them.

Both files use the Windows API calls to get the user's LAN ID and to compare it against a table (Excel - stored list) of user LAN IDs. There is a lookup performed and the appropriate view is displayed depending on the person's status. While someone could get to the table and change their view if they really wanted to, it then becomes their problem, but not a security issue.

Another note, there are slight differences in the versions on the 2 LANs. Besides the obvious operating system and service patch differences, they use different user LAN IDs.

Normally, I account for this by changing a small set of VBA constants using a compiler #IF-THEN-#Else and a global compiler constant in the Project Properties that I switch from 0 to -1, depending on which LAN the files reside on. I keep the same copy on both LANs, but just change the compiler constant to match the LAN. This works fine for blank copies. The difficulty comes later when the application files are populated and they want to transfer the files between LANs.

While I know that I can test to see what operating system the application is running on, I have no guarantee that the 2 LANs won't be using the same operating system in the near future, I just don't know when and I have no control over that, so testing the operating system might work for now to ID the LAN, in the near future, it might not. The LANs are operated by two different organizations.

The problem has become that the users are now having to move their "projects" (my application) between LANs to accomplish their work. While the ideal solution would be to get a blank copy of the version suited for the target LAN and import the data from the transferred project, it is not that easy, especially for the Excel piece. Instead, I am now having to intervene with the users and physically change that global compiler constant in the transferred application and recompile before the user can use their project.


QUESTION: Operating system excluded, is there any other technique, such as a Windows API call or VBA function that I can use to uniquely determine which LAN the application is running on?

That would allow the application to adapt itself to the specific LAN without my intervention.

Thank you ahead of time for your help!



--- Tom
 
It seems the simplest way is to place the ini-like 'signature' file in every LAN (on LAN servers in a dedicated read-only directory, for example).
If the application can't open this file it may ask user or set default mode of operation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top