Note that there are some explanatory texts on larger screens.

plurals
  1. POError when reading registry with Visual Basic 6 running on Win7
    text
    copied!<p>I have inherited a VB6 application from a friend of a family member, who wants to have some enhancements done to it. I haven’t developed in VB for more than 3 years (I’m currently developing in MS Dynamics Ax).<br> I’ve recently upgraded my hardware and am now running Win7. The last time I worked with the app (about a year and a half ago) was on a WinXP platform, and everything worked fine. Now when I run the app (through code) on Win7, I get an error when trying to read from the registry. Yes, I am running VB as administrator.</p> <p>The code to read from the registry is: Public Function sReadRegistry(ByVal hKeyRoot As Long, _ ByVal sSubKey As String, _ ByVal sValueName As String) As String</p> <pre><code>Dim r As Long Dim sData As String * 255 Dim lDataSize As Long Dim sTempVal As String Dim readValue As String lDataSize = 255 'Get the Value Requested lDataSize = 255 r = VRegReadString(hKeyRoot, sSubKey, sValueName, sData, lDataSize) If r Then sTempVal = "" Else sTempVal = Left$(sData, lDataSize - 1) End If sReadRegistry = sTempVal </code></pre> <p>End Function</p> <p>The “VRegReadString “ is declared within a module; and is declared as follows:</p> <pre><code>Declare Function VRegReadString Lib "VREG" (ByVal hKeyRoot As Long, ByVal sSubKey As String, ByVal sValueName As String, ByVal sData As String, ByRef lDataSize As Long) As Long </code></pre> <p>It complains about the “VREG” library… The error I get is: “File not found: VREG”.</p> <p>Is there a reference or component that I forgot to select? Can somebody please help with a solution?</p> <p>Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload