News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Loading information from Registry to edit boxes

Started by timertik, March 29, 2007, 08:21:42 PM

Previous topic - Next topic

timertik

I did some research on this one and found alot of useful information and some good examples
It seems i can use RegQueryValueEx to get information but how can i add the information found in a value to an edit box
using SetDlgItemText
I also tried SHGetValue but with no success

can someone show me how to get a values text from the registry and display it in an editbox
Im lost I though I had it but it turns up blank every time  :'(

Darrel

It depends on what type of data you get. If it's a string SetDlgItemText should work directly. If it's binary data you'll need to convert it to ASCII first.

LimoDriver

If you are using a newer OS ( x64, 2003, Vista ) I prod thee in the following direction:
http://blogs.msdn.com/larryosterman/archive/2006/01/12/512115.aspx

If you have the standard masm32 package installed, I urge you to devour the following tutorial:
"%ROOT%\masm32\examples\bcraven\append" by Bill Cravener.

From the above mentioned tutorial:

QuoteThis simple example shows you how to Create, Write to and Delete Windows registry keys. The utility enables you to add a new menu option to the Windows "Start" button when you right click on it. This new menu option will also show up in Explorer when you right click in the left directory tree window.

The following Registry functions are used: RegCreateKeyEx, RegOpenKeyEx, RegQueryValueEx, RegSetValue, RegDeleteKey, RegCloseKey.

I'm pretty sure that's all you need to know about registry :)
Have fun!

timertik

I cant believe i missed that i tested it out and its exactly what i need  :U

LimoDriver

Yeah, the number of stuff you come across whilst going through the masm32 library routines and examples is HUGE.
You can't be sure you know everything inside just by going through it once or twice because of the sheer volume of the stuff out there.

The worst thing ever is when you code something, debug it, redo it, it looks good, crashes, debug, debug, coffee, debug, it finally works, and then you find the EXACT SAME THING in masm32's examples :)

timertik

could someone help me with this im trying to use the example but still getting blanks

                  invoke RegOpenKeyEx,HKEY_CURRENT_USER,ADDR run_subkey,
                                        0,KEY_QUERY_VALUE,ADDR RegKeyHandle
                        mov KeyStringLngth,MAXLENGTH
                        invoke RegQueryValueEx,RegKeyHandle,0,0,0,ADDR dBuffer,ADDR KeyStringLngth

                        invoke RegCloseKey,RegKeyHandle

                        invoke GetDlgItem,hwnd,EDIT_NAME
                        invoke SetWindowText,eax,ADDR dBuffer


i want to access Software\application\options\WinIni\
and access this value and copy it to edit box
Value name = "name"

but in the example i dont see how it loads the value it just opens a key  :(
how can i get into a value or am i doing something wrong
I have been trying this for a looong time and it always comes up blank although there is data in the value

Darrel

I will assume the following:

run_subkey    BYTE     "Software\application\options\WinIni",0

Quote from: timertik on March 30, 2007, 03:22:06 AM
invoke RegQueryValueEx,RegKeyHandle,0,0,0,ADDR dBuffer,ADDR KeyStringLngth

The first "0" should be something like "ADDR Value_Name_I_Am_Looking_For". RegQueryValueEx requires you to specify what value you wish to query.

Regards,

Darrel

timertik

Thanks man i was working backwards on it now i see the light it works now  :U!
thanks for everyones patience.