How do I get the handle of a dialog in Visual C
-
MFC does not expose the handle to me, or does it? Thanks for fast replies!
Well, GetSafeHwnd() returns a safe handle to the dialog window. do you need something more ?
This signature was proudly tested on animals.
-
Well, GetSafeHwnd() returns a safe handle to the dialog window. do you need something more ?
This signature was proudly tested on animals.
HWND hwndDlg = GetSafeHwnd(); Is it really that simple? How does GetSafeHwnd() know which window you wish the handle of? Thanks
-
HWND hwndDlg = GetSafeHwnd(); Is it really that simple? How does GetSafeHwnd() know which window you wish the handle of? Thanks
jonsey29847 wrote:
How does GetSafeHwnd() know which window you wish the handle of?
It's called in the context of a
CWnd
object."Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
So I can use existing code in an application that I developed using Win32 APIs. i.e.SendMessage(HWND, ID, wparam, lparam) MFC "Hides" this from me. However, if I am taking off in wrong direction I would appreciate some guidance here. Thanks
If you wanted to send a message to some edit control, you could use:
m_edit.SendMessage(WM_GETTEXTLENGTH, 0, 0);
or
::SendMessage(m_edit.GetSafeHwnd(), WM_GETTEXTLENGTH, 0, 0);
or
m_edit.GetWindowTextLength();
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
If you wanted to send a message to some edit control, you could use:
m_edit.SendMessage(WM_GETTEXTLENGTH, 0, 0);
or
::SendMessage(m_edit.GetSafeHwnd(), WM_GETTEXTLENGTH, 0, 0);
or
m_edit.GetWindowTextLength();
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
You have struck upon one of the problems I have using MFC. What does m_edit mean and where can I find a list of all the m_whatever? Thanks
-
You have struck upon one of the problems I have using MFC. What does m_edit mean and where can I find a list of all the m_whatever? Thanks
jonsey29847 wrote:
What does m_edit mean and where can I find a list of all the m_whatever?
It's just an arbitrary name I chose for that code snippet. You may call it whatever you wish.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
jonsey29847 wrote:
What does m_edit mean and where can I find a list of all the m_whatever?
It's just an arbitrary name I chose for that code snippet. You may call it whatever you wish.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Is it the name I assign using the class wizard?
-
Is it the name I assign using the class wizard?
Yes.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Yes.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Wow! I can't wait to try it. I just love this website! Thanks.
-
Hello, I am porting a Dialog based application that I used Lcc-Win32 to develop over to Visual C++. How to I get the handle of my Dialog box? Thanks in advance for your help.
-
Hello, I am porting a Dialog based application that I used Lcc-Win32 to develop over to Visual C++. How to I get the handle of my Dialog box? Thanks in advance for your help.