Hi,
I am a novice programmer & am learning eVC++.
I am trying to create a simple application where in a form containing a text-box, whatever the user feeds in , that text should be displayed in a mesage box on the Click of the button present on the form.

The ID of the textbox is IDC_EDIT1

& I am using the statement:

MessageBox(IDC_EDIT1.Text);

in the OnButton1 function.
But this is giving an error..." left of '.Text' must have class/struct/union type "

Can anyone suggest me the modifications required....

Thanks in advance.

Niks.

Re: Code for Simple eVC++ Application. by Martin

Martin
Wed Oct 15 02:31:37 CDT 2003


"Niks" <anonymous@discussions.microsoft.com> schrieb im Newsbeitrag
news:8A0D31BA-FE03-40DA-B1C6-F627C094EE2E@microsoft.com...
> Hi,
> I am a novice programmer & am learning eVC++.
> I am trying to create a simple application where in a form containing a
text-box, whatever the user feeds in , that text should be displayed in a
mesage box on the Click of the button present on the form.
>
> The ID of the textbox is IDC_EDIT1
>
> & I am using the statement:
>
> MessageBox(IDC_EDIT1.Text);
>
> in the OnButton1 function.
> But this is giving an error..." left of '.Text' must have
class/struct/union type "
>
> Can anyone suggest me the modifications required....
>
> Thanks in advance.
>
> Niks.

please learning C/C++ and reading the Win32-API !!!

TCHAR wcBuffer[128];
// if use dialog
HWND hEdit = GetDlgItem(hwndParent, IDC_EDIT);
// else use CreateWindow( ... )
hEdit = CreateWindow( ... );

GetWindowText(hEdit, wcBuffer, 128);
MessageBox(GetActiveWindow(); TEXT("Edit"), wcBuffer, MB_OK);

Note:
it´s not VB ( IDC_EDIT.Text() ) :-)
read the resource.h => #define IDC_EDIT 1000 // its a konst. not a object
!!!

martin