|
I certainly don't do it that way. But if you think of it, if the button is in the "A" dialog, then the MESSAGE_MAP for "A" should be the place for it. I don't think polymorphism applies to controls.
It may be accidental that the RTLs for the older VS didn't check "ownership" where the newer RTLs do. Might even have been a bugfix for someone complaining that what you relied on was, in fact, a bug deserving of a fix.
Anyway, you've got the root problem figured out.
|
|
|
|
|
The documentation on processing message maps seems to support your concept of "virtual action routines" passing from derived window to parent/base class. So, I'd verify your hierarchy is correct first, then ask Microsoft if it's broken but I wouldn't hold up my application for a fix.
http://msdn.microsoft.com/en-us/library/6kc2tzde(v=VS.100).aspx[^]
The first argument names the class to which the message map belongs. The second argument provides a connection with the immediate base class — CView here — so the framework can search its message map, too.
The message handlers provided in a base class are thus inherited by the derived class. This is very similar to normal virtual member functions without needing to make all handler member functions virtual.
If no handler is found in any of the base-class message maps, default processing of the message is performed. If the message is a command, the framework routes it to the next command target. If it is a standard Windows message, the message is passed to the appropriate default window procedure.
|
|
|
|
|
Yeah, I created a little test MFC app to check, and it works fine there!
|
|
|
|
|
It gets stranger and stranger!
I was paraphrasing my code before, it's more like:
BEGIN_MESSAGE_MAP(B_Dlg, C_Dlg)
ON_BN_CLICKED(IDC_ONE, OnFunctionA)
ON_BN_CLICKED(IDC_TWO, OnFunctionA)
ON_BN_CLICKED(IDC_THREE, OnFunctionA)
ON_BN_CLICKED(IDC_FOUR, OnFunctionB)
ON_BN_CLICKED(IDC_FIVE, OnFunctionC)
END_MESSAGE_MAP()
The message map IS actually working, but only for the first entry in the map! If I change the order, I can change what works and what doesn't...
|
|
|
|
|
Check to make sure that the IDC_ numbers aren't messed up in the resource file. If they're somehow the same, that would cause this behavior you're seeing.
|
|
|
|
|
I'm not 100% sure but I strongly suspect this is caused by changes to the message map macros.
Check out BEGIN_MESSAGE_MAP etc. in:
C:\Program Files\Microsoft Visual Studio\VC98\MFC\Include\AFXWIN.H
and compare with:
C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxwin.h
|
|
|
|
|
It just occurred to me that if they changed how the macros generate the map tables, there'd be corresponding changes to the RTL to support it. So make sure the project conversion didn't leave some old libraries that you link with. You might have an explicit link in the project that should be updated for VS2010. Since you have both installed (I assume), you wouldn't get link errors but you'd see runtime oddities.
|
|
|
|
|
You may need to change whats being passed in the message map macros:
ON_BN_CLICKED(IDC_MYBUTTON, OnMyButton)
would become:
ON_BN_CLICKED(IDC_MYBUTTON, &CYourClass::OnMyButton)
If you vote me down, my score will only get lower
|
|
|
|
|
Ok ages ago in my conversion process I was trying to get rid of all the:
warning C4407: cast between different pointer to member representations, compiler may generate incorrect code
warnings from my dialog code. I added /vmg /vmv and forgot about it.
This caused all my function pointers in the dialog message maps to be 16 bytes long instead of 4, breaking everything while complaining about nothing!
|
|
|
|
|
wow, nice find. How'd you ever figure that out?
|
|
|
|
|
I replaced the BEGIN_MESSAGE_MAP macro with its expanded form and stepped through the population of the message map array. It was then easy to compare the (apparent) size of the AFX_MESSAGE_ENTRY structure with the amount of info being poked in at the memory location.
|
|
|
|
|
When we upgraded to VC10 from VC6 we did this exact same thing and everythng broke also.
If you vote me down, my score will only get lower
|
|
|
|
|
Hello Friends
I am reading a xml file(suppose A.xml) using MSXML::IXMLDOMDocumentPtr and all related classes of MSXML.
Now,I want to create another xml file with new data and want to replace with A.xml.
Both xml will be having same Nodes but their child nodes can be different.
Now,My question is
Is there any way that I can store all the data in DomDocumentPtr object and then replace with it existing xml file Dom Pointer?
Or do i need to create another xml on disc and then i have to replace one file with another file.
Which way i can achieve this?
Thanks and Regards
Yogesh sikri
|
|
|
|
|
XmlDocument::ImportNode does the job, It states and i quote:
"The ImportNode method is the mechanism by which a node or entire node subtree is copied from one XmlDocument to another. The node returned from the call is a copy of the node from the source document, including attribute values, the node name, node type, and all namespace-related attributes such as the prefix, local name, and namespace Uniform Resource Identifier (URI). The source document is not changed. "
more from MSDN..
Code from MSDN:
#using <System.Xml.dll>
using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
XmlDocument^ doc = gcnew XmlDocument;
doc->LoadXml( "<bookstore><book genre='novel' ISBN='1-861001-57-5'><title>Pride And Prejudice</title></book></bookstore>" );
XmlDocument^ doc2 = gcnew XmlDocument;
doc2->Load( "books.xml" );
XmlNode^ newBook = doc->ImportNode( doc2->DocumentElement->LastChild, true );
doc->DocumentElement->AppendChild( newBook );
Console::WriteLine( "Display the modified XML..." );
doc->Save( Console::Out );
}
|
|
|
|
|
Hi all,
I want to learn embedded systems, and looking some reading materials which explain from the basic concepts. About PIC programming, designing simple circuit and so on.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
This is the same guy who said "debugging is the oposite of programming".
My advice is to stop wasting our time with silly questions like this. If you had ANY intention of actually becoming an embedded programmer than you would already have books on the various processors used, ARM, Siemens etc and commonly used hardware such as PICs and FPGAs.
==============================
Nothing to say.
|
|
|
|
|
Erudite__Eric wrote: This is the same guy who said "debugging is the oposite of programming".
Yes I am.
Erudite__Eric wrote: My advice is to stop wasting our time with silly questions like this.
I wonder that this is the way experienced members in code project helping others. It may be silly question to you, but not for me. I have an interesting to learn embedded systems, and that is why I ask it openly. Since I have experienced in C/C++ a lot, I decide to plan something beyond that, yet relevant. That is why I ask my question in C/C++ forum too.
If you have any solution please let know. If not don't say anything to discourage others. If you really want to do that, show me the pros and cons I have.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Your question is too broad, too unfocused, not specific.
Your previous question about assembler, trying to turn a led on and off, what hardware were you running it on? Was it a test board, or some real bit of hardware you got hold of? How were you loading your code onto the hardware?
See what I mean?
If you want to learn embedded programming then get yourself some test/development hardware that you can practice on. Look on google. OSR used to do one I seem to recall.
==============================
Nothing to say.
|
|
|
|
|
Now I see your point. Sorry for the confusion.
May be that is because of I haven't much knowledge related with Embedded systems, pic and so on. So I have no clear picture in my mind about the stuff. You guys can guide me on to the relevant track. Basically I want to use my knowledge of C/C++ in hardware stuff, like PIC and so on. I have only my own interest, nothing to do with my job.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: If you have any solution please let know.
Solution to what? You say you want to learn programming on embedded systesms, PIC etc., have you tried the obvious starting point[^]?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Of course I tried mate. Already collect some stuff. But most of them are too complex to understand at once, because of the lack of knowledge on the basis.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
This looks good:
http://www.quasarelectronics.com/3081-pic16f84a-introduction-to-pic-programming-tutorial.htm[^]
Now, if you dont order that straight away and start learning, we will never answer another question of yours.
--edit--
Actually, at £17 thats damn cheap, I might get one myself, always fancied doing a bit more embedded!
(I have been working in the Windows kernel for 13 years, mostly hardware related, but it could be fun to get right into the hardware. I also ought to learn the Linux kernel some time...)
|
|
|
|
|
That make sense to me too.
I already bought simple electronic components too, to familiarize with them. At the time I'll put an order on this too. Download a simple simulator and working on it too.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: But most of them are too complex to understand at once
So how do you think posting questions here will change that? The only way to learn is to study hard and practice. These forums are for technical questions not for "How can I learn X?".
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Don't misinterpret the original question mate. I am asking about some reading materials where I can learn the basis on embedded systems and all. Not expecting any code or anything. So far I haven't make such a request on CP too.
I ask about the materials because people who has already refer them have a better understanding about the stuff.
I appreciate your help all the time...
CodingLover
|
|
|
|