GUI Issues

Mar 16, 2011 at 1:21pm
Hello all,

I am new to windows programming. I have created a simple GUI using MFC AppWizard (exe). While working I need to put data in Edit box via SetDlgItemText(hDlg,nIDDlgItem,lpString).
First parameter is handle of Window. I am not able to get the same. Please help me go ahead.


Thanks and Regards,
Abhishek
Last edited on Mar 16, 2011 at 5:08pm
Mar 16, 2011 at 5:08pm
Please help people
Mar 16, 2011 at 5:17pm
You should give us more time to respond. Someone isn't always on the forum.

Anyway if you're using MFC, you probably wouldn't use SetDlgItemText, you'd probably use CWnd::SetWindowText.

It's been a while since I've used MFC, but iirc you need to tie your edit box to a CEdit control. In VS, you can do this with the Class Wizard (or at least you could back in the day -- like I said it's been a while for me).

Then when you have an CEdit object you can just do this:

1
2
// CEdit m_myeditctrl;  // ClassWizard makes this for you in your header file
m_myeditctrl.SetWindowText(_T("Whatever you want in your edit box"));
Mar 17, 2011 at 8:29am
I am working in a thread and the way you told me leads to Debug assertion error. The thread is outside the class.
Mar 17, 2011 at 3:40pm
Did classwizard make the CEdit control for you? Or did you just type it into your header?

Classwizard does a few other "magical" things to bind the CEdit to the actual control. If you did it yourself you probably missed a step and that's causing the assertion error.
Mar 17, 2011 at 3:47pm
Hello I am working on a project such as multiple video playback
Play and do I save a file to the database?
Topic archived. No new replies allowed.