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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to tell if Visual Studio 6 is installed 1

Status
Not open for further replies.

troyu

Programmer
Nov 21, 2000
185
CA
Is there a file I can refer to to know that the Visual Studio 6 application has been installed on a computer?
 
We are trying to run a check to see what users have this software installed. Originally, my thinking was that we could simply refer to the file "install.htm", located in C:\program files\microsoft visual studio. However, if users installed a component from another CD from the 28 CD's included with Visual Studio Enterprise (like Visual Basic 6.0) instead of installing from the main Enterprise Edition CD (#1), then this install.htm file is not present in that directory.

We are using Marimba to go out and find out if this software is installed, and we need to check for a file to do so.


 
perhaps vb6.exe would be a good indicator (or at least as good as any if you're just checking for files) that the program is installed.
 
This would not work, as a user could install c++ only, or foxpro only from the CD. Something that is common for all these scenarios have to be found.
 
could you not check the registry?

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Visual Basic
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio

etc?

If somethings hard to do, its not worth doing - Homer Simpson
 
ADoozer-

Are these keys still present even after VS as been uninstalled?
 
no idea. ive never uninstalled any visual products.

another option might be to look in

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MS Setup (ACME)\Table Files

there should be some Values along the lines of

Visual Basic 6.0 Enterprise Edition@v6.0.0.0.0626 (1033)
Visual C++ 6.0 Enterprise Edition@v6.0.0.0.0626 (1033)

u could then use the paths stored in the strings to look for the exe's

again, dont know if these remain after uninstalation.

If somethings hard to do, its not worth doing - Homer Simpson
 
Come on guys, keep thinking, you're almost there (where 'there' is the solution I'd be likely to use for this) ...
 
I was thinking to look for VisualStudio.Solution in HKEY_CLASSES_ROOT. Or MSENV.DLL, which is the file that it points to. On the other hand, I tried renaming it and VB still comes up, which I didn't expect. On the other hand, it's probably a file that installs with every type of IDE on VS. I'd try installing each type of IDE and seeing if the file is there, if I really wanted to know.

Bob
 
where 'there' is the solution I'd be likely to use for this

a recursive search using a collection and regular expressions?

If somethings hard to do, its not worth doing - Homer Simpson
 
Couldn't you enumerate the registry keys located at...

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

On my computer I have (among many others)

Visual Studio .NET Enterprise Developer - English
Visual Studio 6.0 Enterprise Edition
Visual Studio 6.0 TypeLib Information object library

If I'm not mistaken, this is where windows stores what software has been installed on your computer. So, the only way that Visual Studio could be on your computer without it appearing in this list would be a manual install, which would be prohibitively difficult.

Additionally, if Visual Studio is uninstalled, then the appropriate registry entry would be removed.

And, since this involves enumerating registry keys, you could use BOTH api's and regular expressions, which should satisify strongm. [bigsmile]

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
strongm approves! Yes! I'm asking for a raise!

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
And here's a starting point (based on some code originally posted by Hypetia). You'll need a form with a listbox (sorted set to true):
Code:
[blue]Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As Any) As Long
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Const UninstallKey = "Software\Microsoft\Windows\CurrentVersion\Uninstall"
Const HKEY_LOCAL_MACHINE = &H80000002
Const KEY_ENUMERATE_SUB_KEYS = &H8
Const KEY_QUERY_VALUE = &H1
Const ERROR_SUCCESS = 0&

Private Sub Form_Load()
    Dim hKey As Long, hSubKey As Long
    Dim SubKey As String * 1000, Index As Long
    Dim pData As String * 1000, lData As Long
    
    RegOpenKeyEx HKEY_LOCAL_MACHINE, UninstallKey, 0, KEY_ENUMERATE_SUB_KEYS, hKey
    Form1.Show
    While RegEnumKeyEx(hKey, Index, SubKey, Len(SubKey), 0, vbNullString, ByVal 0&, ByVal 0&) = ERROR_SUCCESS
        lData = Len(pData)
        RegOpenKeyEx HKEY_LOCAL_MACHINE, UninstallKey & "\" & SubKey, 0, KEY_QUERY_VALUE, hSubKey
        If RegQueryValueEx(hSubKey, "DisplayName", 0, ByVal 0, ByVal pData, lData) = ERROR_SUCCESS Then List1.AddItem pData
        RegCloseKey hSubKey
        Index = Index + 1
    Wend
    RegCloseKey hKey
End Sub
Private Sub Form_Resize()
    List1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top