Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieveing From Registry

Status
Not open for further replies.

PaulWilson

Technical User
Jul 31, 2003
1
US
How would I go about retrieving the text for and edit box in dialog 2 when the box is on dialog 1?

I've tried everything I can think of but nothing works. The edit box is called m_edit1_dlg1 and is "public" but I can't figure out how to access the text at all :(

This led me to use the registry but I'm having problems there too. All the form values (I have several edit boxes) are being correctly inserted into the registry but when retrieving them to fill up the form after clicking a button, a few fields never fill....the missing fields vary from time to time. I thought it was a problem with buffering but I'm new to this and really have no idea...this is a code sample to retrieve from the registry:

HKEY key;
DWORD size, type;

if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,APPLICATION_KEY,0,KEY_QUERY_VALUE,&key) == ERROR_SUCCESS)
{
// Read
size = 128;
type = REG_SZ;

// Field 1
LPCSTR psz1 = m_edit1_dlg1.GetBuffer(size);
RegQueryValueEx(key, "CGI Path", 0, &type, (LPBYTE)psz1, &size);
m_edit1_dlg1.ReleaseBuffer();

// Loads more retrievals like above.
}

Then I use:

GetDlgItem( FIELD_NAME )->SetWindowText(m_field_dlg);

....where m_field_dlg is obviously the correct field.

Thanks for any help anyone can give.
 
Add a member variable (type CString) in the class wizard and associate it with the control. Then use UpdateData(TRUE/FALSE) to set and get it.

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top