Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get CEdit control in CDaoRecordView

0 views
Skip to first unread message

Ross Bartick

unread,
Mar 31, 1998, 3:00:00 AM3/31/98
to

Hello all,

I am working on an MFC/DAO application. My CDaoRecordViews have a few CEdit
controls which allow me to edit my Database Tables.

I need to get a reference to the CEdit control which has the focus. I cannot
figure out how this is done. I want to put this code in my generic parent
class so I do not want to hardcode any dialog ids in the solution. I just
need a way to get a pointer/reference to the CEdit control which has the
focus.

Does anyone have any ideas?

Thanks,

--Ross--
rbar...@i-2000.com


John Cornell

unread,
Apr 1, 1998, 3:00:00 AM4/1/98
to

How about:
CEdit* pEdit = ((CEdit*)(pView->m_hWnd.GetFocus()));

Where pView is a pointer to the current CDaoRecordView class.


Ross Bartick <rbar...@i-2000.com> wrote in article
<eJyfW7Y...@uppssnewspub05.moswest.msn.net>...

Ross Bartick

unread,
Apr 1, 1998, 3:00:00 AM4/1/98
to

Thanks John. Your solution looks great.

--Ross--

>"John Cornell" wrote:
>How about:
> CEdit* pEdit = ((CEdit*)(pView->m_hWnd.GetFocus()));
>
>Where pView is a pointer to the current CDaoRecordView class.

>>Ross Bartick <rbar...@i-2000.com> wrote in article

>> I need to get a reference to the CEdit control which has the focus.

Ross Bartick

unread,
Apr 1, 1998, 3:00:00 AM4/1/98
to

>>How about:
>> CEdit* pEdit = ((CEdit*)(pView->m_hWnd.GetFocus()));

The above line will not work. It needs to be written as follows:

CEdit* pEdit = ((CEdit*)(FromHandle(pView->m_hWnd)->GetFocus()));

--Ross--

0 new messages