Gossamer Forum
Quote Reply
C++
If I use:

CDialog::EndDialog(FALSE);

...is it possible to get the value of a text box from the dialog I've "ended" from the next dialog I load?

I've tried the following in the third dialog class but it doesn't seem to work:

Code:
MySecondClass dlg2;
dlg2.GetDlgItem(ID_OF_TEXT_BOX)->GetWindowText(new_cstring);

I've tried a couple of other things to but can't figure out how to do it. I've not found anything searching the net either.

Last edited by:

Paul: Sep 16, 2002, 2:53 PM
Quote Reply
Re: [Paul] C++ In reply to
I think this may be what I need.

http://staff.develop.com/...rep0596.htm#Heading2
Quote Reply
Re: [Paul] C++ In reply to
Nope I don't think it was. According to an article I just read, declaring my variable as public should work, but it doesn't seem to ;(

Code:
// Construction
public:
CSupportSQLDlg2(CWnd* pParent = NULL); // standard constructor
CString m_edit2_dlg2;

That is in class 2, then in class 3 I have:

Code:
CString s;
Class_2_Name dlg;
s = dlg.m_edit2_dlg2;

....but s is empty :(

Last edited by:

Paul: Sep 16, 2002, 6:45 PM
Quote Reply
Re: [Paul] C++ In reply to
I think i may actually use the registry to store the data so everytime the app runs after the first time the old values will be loaded into the form.
Quote Reply
Re: [Paul] C++ In reply to
Ok I used the registry....if anyone is interested....

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

// Read field one from the registry.
LPCSTR psz1 = m_edit1_dlg2.GetBuffer(size);
RegQueryValueEx(key, "CGI Path", 0, &type, (LPBYTE)psz1, &size);
m_edit1_dlg2.ReleaseBuffer();

// Set the value back to the text box.
GetDlgItem( IDC_EDIT1 )->SetWindowText(m_edit1_dlg2);

// Stuff...
}

Last edited by:

Paul: Sep 17, 2002, 6:26 AM
Quote Reply
Re: [Paul] C++ In reply to
This really sucks. I have about 11 fields and when I read from the registry a few never auto-fill.

I've scowered the code looking for errors but everything is right.....could it be something to do with ReleaseBuffer() I wonder?
Quote Reply
Re: [Paul] C++ In reply to
You may find this to be a lonely thread.. Haven't seen many C++ programers around here. =) (Although Scott's been doing more and more C coding, but nothing Win32 related).

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] C++ In reply to
Tek-Tips.com is a good source for help with almost any language :D

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!