Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Reading The Registry

Posted on 1999-06-30
Medium Priority
Last Modified: 2010-05-02
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++".
Question by:amird
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3

Author Comment

ID: 1521242

Accepted Solution

LeeGar earned 160 total points
ID: 1521243
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

Expert Comment

ID: 1521244

msgbox ProductDir$
RegCloseKey (handlekey&)
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 1521245
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) ??


Expert Comment

ID: 1521246
don't understand your second question....

Author Comment

ID: 1521247
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 ?)


Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question