|
Right. So I am having problems transferring the data from the vector to the list.
How do I work around doing that in my case? I tied casting, it compiled but the application crashes at runtime.
Thanks.
|
|
|
|
|
Anderson Jogie wrote: How do I work around doing that in my case?
That's impossible to tell since I know nothing of either of those two classes. For example, how would you copy a vector of Automobile objects to a list of Animal objects?
Anderson Jogie wrote: I tied casting, it compiled but the application crashes at runtime.
That would not work unless the two classes had a "is a" relationship.
"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
|
|
|
|
|
DavidCrow wrote: That would not work unless the two classes had a "is a" relationship.
Reading that it occurred to me that a more casual (possibly less informed) reader might look at that, pause, and then have their head explode.
|
|
|
|
|
I agree.
"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
|
|
|
|
|
I'm not an STL expert, but after a quick google (bing did not give valid answers in the first few pages), here are a couple of solutions (adapt to your particular situation)
std::copy (v.begin (), v.end (), std::back_inserter (l))
or
std::list<int> l(v.begin(), v.end());
or ...
This signature was proudly tested on animals.
|
|
|
|
|
So you binged it, but it bonged out?
|
|
|
|
|
Just so you know, std::vector and std::list have nothing to do with MFC. They are part of STL or Standard Template Library and are cross platform.
|
|
|
|
|
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.
|
|
|
|
|
jonsey29847 wrote: How to I get the handle of my Dialog box?
For what purpose?
"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
|
|
|
|
|
That question confuses me. What am I missing Dave? Just curious.
|
|
|
|
|
led mike wrote: That question confuses me.
Mine or the OP's?
"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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
Wow!
I can't wait to try it.
I just love this website!
Thanks.
|
|
|
|
|
If it's your dialog, you probably have a variable assigned to it.
YourDialog dlg;
or
YourDialog* pDlg;
pDlg = new YourDialog;
after you create the dialog (Create ), you could do something like
HWND CWnd::GetSafeHwnd( ) const;
to get the handle to the dialog.
This signature was proudly tested on animals.
|
|
|
|
|
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.
|
|
|
|
|
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
|
|
|
|
|
associate a class with dialog and use object of that class to access dialog.
|
|
|
|