|
Well, after a day banging my head against the wall on this issue. I finally tracked down the issue.
Its not my code at all. Its the windows kernal.
Apparently, the stack used for nested windows is in the kernal memory and their is a max limit of the nesting depth at which a call to MoveWindow will fail to send a WM_SIZE message to the re-sized window.
To get around this my CSplitterWnd derived class (I already had one), just uses a PostMessage to itself to defer the call to RecalcLayout which does the MoveWindow calls. If I do this the windows get resized in stages down the window chain and they all work correctly as the kernal stack limit never gets hit.
If you vote me down, my score will only get lower
|
|
|
|
|
Mr. Dear friends,
First of all I wish good work come easy.
May I ask you a question about C + + builder?
The following questions in the writing programs in C + + or c + + builder can you help?
I am new software languages. Vey in C + + Builder C + + code, scripts, etc.. I do not know with no interest.
Dear friends help you if you would like to thank you now wish you good work.
question:
- The user's name, last name, phone, address, professional educational status, marital status of many of the sections in this form in a form designed for entering data.
- Also entered in our database, this data must be stored in the old records and see how a program will be reached if needed, this information is written? "
Best Regards
Thanks
Kenan
|
|
|
|
|
What exactly does this have to do with C++? Your question appears to be concerned with the layout of a form or the definition of a database table. Please try rewording your query.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Since I converted from VS6 to VS2010, I have found that lots of my dialog messages no longer work (e.g., BN_CLICKED, CBN_SELCHANGED).
I can Spy++ on the dialog and see the WM_COMMAND with the right notify code, by my dialogs handlers aren't getting the messages.
I expected some issues on upgrading, but this wasn't one of them!
Any suggestions on how to find out what is happening to my messages?
Cheers
|
|
|
|
|
You could try "Create New Project from Existing Code" if the conversion is problematic.
VC++ 10 is a lot better on conformance to the standard, so you may find the VC++ 6 source code no longer compiles even when you have a working project file (a good thing). Fixing such problems up is not generally too hard.
BTW Visual C++ 2010 Express does not have MFC. To compile MFC in Visual C++ 2010 Express read THIS.
|
|
|
|
|
I've done the conversion - it compiles, links and runs.
It just doesn't work.
|
|
|
|
|
I converted a dozen or so projects and never had this particular problem. So I'd check the basics.
1) does the BEGIN_MESSAGE_MAP() have the proper chain of derived and parent classes.
2) does the IDCs of the controls you are expecting map properly to the controls in the dialog you are displaying? I have seen things work by accident because older versions of Visual Studio allowed duplicate IDCs in separate dialogs but the code didn't expect that. Verify then against Resource.h.
3) are controls subclassed properly with DDX (if doing that)
There are a lot of things that need to be stitched together properly for the magic to work.
|
|
|
|
|
Chuck O'Toole wrote: 1) does the BEGIN_MESSAGE_MAP() have the proper chain of derived and parent
classes.
These are OK - or at least, they haven't changed.
Chuck O'Toole wrote: 2) does the IDCs of the controls you are expecting map properly to the controls
in the dialog you are displaying? I have seen things work by accident because
older versions of Visual Studio allowed duplicate IDCs in separate dialogs but
the code didn't expect that. Verify then against Resource.h.
I don't think this is it, I have no duplicate IDs.
Chuck O'Toole wrote: 3) are controls subclassed properly with DDX (if doing that)
I'm not doing this!
This[^] exactly describes my symptoms, but doesn't give a solution (for me anyway).
The only other relevant thing is that I moved all my resources to a DLL (for reasons of internationalisation!). But they all still have the same IDs etc.
Thoughts (and thanks!)?
|
|
|
|
|
The suggestions on that forum page you referenced were pretty good. Especially the part about checking the actual .rc file to make sure all the symbols line up for the control in question.
It also suggested a place to put a breakpoint in the windows dispatch / search routine where it actually tries to match up your MESSAGE_MAP entry (IDC) with the IDC of the control that was clicked (RC file).
Lastly, and it's always a good suggestion, do a clean / complete rebuild to force a recompile of all the resource and source files to make sure everybody's using the same files. That may not have happened if you did a "convert in place" from the old to the new project.
Me, I'd do the full rebuild and the debug from the AFX dispatch to see where it's looking for MESSAGE_MAP entries and why it can't find yours.
|
|
|
|
|
Thanks for your help. I have found a way to fix it - but I wonder if this is a change required by VS2010, or if something deeper is wrong.
Lets say I'm on dialog A, which is a kind of dialog B. Currently, in A.cpp:
BEGIN_MESSAGE_MAP(A_Dlg, B_Dlg)
END_MESSAGE_MAP()
and in B.cpp:
BEGIN_MESSAGE_MAP(B_Dlg, C_Dlg)
ON_BN_CLICKED(IDC_MYBUTTON, OnMyButton)
END_MESSAGE_MAP()
This previously worked fine and allowed me to use IDC_MYBUTTON on all "B" dialogs to give me a generic B-dialog function.
If I add ON_BN_CLICKED(IDC_MYBUTTON, OnMyButton) to the A-dialog message map, the routing works. But why is this necessary? I added the function to the "B" base class so I WOULDN'T have to do this sort of thing.
|
|
|
|
|
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
|
|
|
|