Dialog Boxes

Hello Experts...

At first... NOT USING MFC.
Well, I'm trying to learn something about Dialog Boxes...

I created a Dialog Box...
It has 1 Edit, and two buttons.
Style Overlapped, Visible.

Just trying to show it as modal less, I use something like this:

hDlgTest = CreateDialog(hInst, (LPCTSTR)IDD_DLGTEST,hWnd,(DLGPROC)DlgTest);

All the parameters seem to be fine, the resourse Id, the owner, and the Proc.
It shows the dialog as owner's child.
Whats could be wrong?.

Seccond... I try to get the text of the Edit.

LRESULT CALLBACK DlgTest(HWND hTest, UINT message, WPARAM wParam, LPARAM lParam)



switch (message)

            case WM_INITDIALOG:
                  return TRUE;
      case WM_COMMAND:
      switch (wParam)
            case IDOK: //Button
            DestroyWindow (hTest);
            case IDC_TEXT: //button2
                GetDlgItemText(hTest,(int)TTEXT, Texto, 50);


Well... The seccond button = GPF...
Hwo can help me?.

I would appresiate an example of code for a modal less dialog, with an edit and a button that gets the text in the edit.

Well... It seems to be easier to create a dialog with createWindow than doing it by designing it with the resourse editor :-)


I'm sorry for the points, but when you learn this language... you save points :-)

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi Marsc,

you have to allocate a memory for Texto, i.e.:

char Texto[50];


LPCTSTR Texto= new char [50];
GetDlgItem( hTest, (int)TTEXT, Texto, 50 );
// do anything with the Texto
delete[] Texto;

hope that helps,


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MarscAuthor Commented:

Well... thanks...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.