Shoutbox

Accessing registry in VB - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: Accessing registry in VB (/showthread.php?tid=14944)

Accessing registry in VB by wipey on 08-28-2003 at 08:39 PM

how do I read from the registry the plugin dir key, I've looked at a million examples and they've all just confused me:(


RE: Accessing registry in VB by Choli on 08-29-2003 at 06:44 PM

You have to use the following API functions. Search them in Google where you'll sure find great examples of how to use them and detailed information about what each one does exactly.

code:
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

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


RE: Accessing registry in VB by wipey on 08-29-2003 at 08:56 PM

okay....thx, sorry for shoutin at u in the other post:$ unlike most ppl tho I'm learnin vb thro examples so it's pretty hard:@


RE: Accessing registry in VB by wipey on 09-01-2003 at 06:30 PM

so let me get this straight, I open key using the first command, close it using the second and get it's value using the third:D?

why Ex tho?:S


RE: Accessing registry in VB by Choli on 09-01-2003 at 06:58 PM

quote:
Originally posted by wipey
so let me get this straight, I open key using the first command, close it using the second and get it's value using the third?

Yes.
quote:
why Ex tho?

Ex? RegOpenKeyEx and RegQueryValueEx? That's the name of the API. Don't worry about that.
RE: Accessing registry in VB by wipey on 09-01-2003 at 10:10 PM

cool thx I'm gonna try it:)
it's something to do with ansi/unicode aint it (I think:S)
is there any like database or anything which tells u what each api is for?


RE: RE: Accessing registry in VB by Choli on 09-01-2003 at 10:47 PM

quote:
Originally posted by wipey
cool thx I'm gonna try it:)

;)
quote:
it's something to do with ansi/unicode aint it (I think:S)

If you want the unicode versions of those APIs (only for Windows NT/2000/XP/2003) change the "Alias <Name>A" and put "Alias <Name>W"
quote:
is there any like database or anything which tells u what each api is for?

Yes, of course. There are lots of sites where you can learn a lot of APIs and how to use them. In fact, all what I know about APIs, I learnt it reading tutorials on the Internet. I suggest you to see www.allapi.net and look for API information at www.microsoft.com. I've just found and updated version of an old guide I had. I think its url is http://www.pietschsoft.com/programming/vbapi/. I haven't read it yet, but if it's as good as the original one, I suggest you to view it. Really it's very good.
RE: Accessing registry in VB by wipey on 09-02-2003 at 12:50 AM

cool I done it, I also learned a few new things:)
.bas files are for declaring constants and public functions yea(?) and generally making your code more organized:D