Reading Registry Keys
BlitzPlus Forums/BlitzPlus Programming/Reading Registry Keys
| ||
I got some decls from COde Archives.. but no one worked with me.. The problem is.. i'm trying to read a subkey from my registry with Blitz. How can i do that? By the way.. the key is: HKEY_CURRENT_USER\Software\Patchou\Messenger Plus! Live\mscansian@... I need to read the value from that key and put it on a string :) thanks for helping! |
| ||
(This was far longer than I intended, but hopefully it covers everything you'll need :)) I don't have Messenger Plus installed, so I can't check, but is LogsDirectory a key or a field? I'm guessing it's a field, in which case the following should work. I'm also going to guess that the field is of type REG_EXPAND_SZ. What that means is the key will contain something like "%USERPROFILE%" as well as the path. I'm pretty sure the code in the archives doesn't handle that key type. I've included a function to sort out the paths too :) Anyway, hopefully the code below will help out: AdvApi32.decls .lib "advapi32.dll" AdvApi32_RegOpenKey%(hKey%, subKey$, result*):"RegOpenKeyA" AdvApi32_RegCloseKey%(hKey%):"RegCloseKey" AdvApi32_RegQueryValueEx%(hKey%, lpValueName$, lpReserved%, lpType*, lpData*, lpcbData*):"RegQueryValueExA" Helper functions: And finally, an example or two :) ; Include your helper functions here Print AA32_GetRegistryKey(HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Themes", "InstallTheme") Print AA32_GetRegistryKey(HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Desktop\General", "Wallpaper") If you get a result that contains "%USERPROFILE%" or similar, the code below can be used to get the actual value: Kernel32.decls .lib "kernel32.dll" Kernel32_ExpandEnvironmentStrings%(inputString$, outputBank*, maxSize%):"ExpandEnvironmentStringsA" Helper function and examples: Hope that helps! |
| ||
Yep.. that worked :D thks! |