Reading The Registry

Could you please write me the code that search for did the user installed his VC++ (the name of the variable is ProductDir), and return its value, for example:"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\DevStudio\\6.0\\Products\\Microsoft Visual C++".
Who is Participating?
LeeGarConnect With a Mentor Commented:
Public Declare Function RegCreateKeyA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long

Public Declare Function RegQueryValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long

Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Public Const REG_SZ As Long = 1
Public Const HKEY_LOCAL_MACHINE As Long = &H80000002
Public stringbuffer As String * 255

Private Sub Form_Load()

  subkey$="software\Microsoft\DevStudio\6.0\Products\Microsoft  Visual C++"

  RegCreateKeyA HKEY_LOCAL_MACHINE, subkey$, handlekey&

  RegQueryValueExA  handlekey&, " ProductDir", 0, REG_SZ, ByVal stringbuffer, 255
  ProductDir$ = ltrim(rtrim(stringbuffer))

  msgbox  stringbuffer

End Sub
amirdAuthor Commented:

msgbox ProductDir$
RegCloseKey (handlekey&)
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

amirdAuthor Commented:
thanks a lot !!

Do you happen to know how to terminate the VB application and other processes called by her (i.e MSDEV.EXE,CL.EXE,CMD.EXE) ??

don't understand your second question....
amirdAuthor Commented:
during my vb app i call to other processes that continue to run even thogh that my vb app is not !!,
how do i stop them from running (something like terminate process ?)

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.