vba - Error when reading registry with Visual Basic 6 running on Win7 -
i have inherited vb6 application friend of family member, wants have enhancements done it. haven’t developed in vb more 3 years (i’m developing in ms dynamics ax).
i’ve upgraded hardware , running win7. last time worked app (about year , half ago) on winxp platform, , worked fine. when run app (through code) on win7, error when trying read registry. yes, running vb administrator.
the code read registry is: public function sreadregistry(byval hkeyroot long, _ byval ssubkey string, _ byval svaluename string) string
dim r long dim sdata string * 255 dim ldatasize long dim stempval string dim readvalue string ldatasize = 255 'get value requested ldatasize = 255 r = vregreadstring(hkeyroot, ssubkey, svaluename, sdata, ldatasize) if r stempval = "" else stempval = left$(sdata, ldatasize - 1) end if sreadregistry = stempval
end function
the “vregreadstring “ declared within module; , declared follows:
declare function vregreadstring lib "vreg" (byval hkeyroot long, byval ssubkey string, byval svaluename string, byval sdata string, byref ldatasize long) long
it complains “vreg” library… error is: “file not found: vreg”.
is there reference or component forgot select? can please solution?
thanks in advance.
seeing function declaration import external library called "vreg", missing actual library itself, i.e. vreg.dll. unfortunately, doesn't seem common library, you'd have come yourself.
good news is, though, accessing registry not hard , can done bare windows api, seeing vreg.dll not seem add deal of abstraction regular api. take @ these functions:
...which can use re-write registry access, provided fail procure needed dll somewhere.
Comments
Post a Comment