I don't know what you are trying to achieve, but even if you were to manage to have two different copy constructors now, I think you would be laying a maintenance minefield. Reading your code it is not easy to understand which version will be invoked and what happens. Seeing
gives no clue that b is modified. You, or others, may not recall this when maintaining the code.
If possible, implement the const copy constructor that uses a const object.
Think of a good descriptive name to call the non-const version, and do a two-step construction, if necessary creating a separate constructor to create an empty or invalid object, e.g.
AClass a;<br />
If these are always created on the heap you could make a simple helper function to do the work
AClass* pA = CreateNewClassAndModify(b);
I'm sure there are other ways.
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
(also posted on the dundas forum)
I'm using the Dundas grid to display a simple grid.
In one of the cell, I use the Ellipsis Cell type, it's a cell type with a "..." button to call up a dialog.
When I click on the "..." button my dialog is called, but it's not "modal", the grid still has focus and I can click the button again and again. seems the dialog message loop is overridden for at least one message, if I click on the dialog, the dialog really become modal.
This code is copied from the cell type Dundas sample. ( and I tried the same thing with the dundas demo to see if the problem is in my code )
It's a small problem, but it's bugging and I'm not certain why the DoModal does really eat the messages, and there's one message that get handled by the underlying grid.
Solution : There was SetCapture that was not supposed to be there. I removed it, tested all relevant code and behaviour and now everything is ok; no need to disable parent window or do other things, DoModal works as is should.
Modal dialogs in MFC are not really modal, and I believe that this allows for better message handling in the MFC framework. Modal dialogs just disable their parent to simulate a modal dialog.
You should be able to manually disable the dialog's parent to get around this problem.
-=- James Please rate this message - let me know if I helped or not!<hr></hr>If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
pView->whatever() causes ASSERT as defined in wincore.cpp - void CWnd::AssertValid()
CDocument::OnCommand - selected some operation from menu
CView *pView = get active view
call DLL (pView, p2, p3, ...)
put up dialog
move slider, now need to update pView in main app
callback(pView, p2, p3 ...)
No matter if I pass a ptr to CDocument or CView the callback will fail (ASSERT) someplace
If I pass in the HWND and in the callback use CWnd::FromHandle() and then call InvalidateRect() I can get thinks to redraw but I want to access items in the Doc or View.
The ASSERT code states
// Note: if either of the above asserts fire and you are
// writing a multithreaded application, it is likely that
// you have passed a C++ object from one thread to another
// and have used that object in a way that was not intended.
// (only simple inline wrapper functions should be used)
// In general, CWnd objects should be passed by HWND from
// one thread to another. The receiving thread can wrap
// the HWND with a CWnd object by using CWnd::FromHandle.
// It is dangerous to pass C++ objects from one thread to
// another, unless the objects are designed to be used in
// such a manner.
So does anyone have a way around this?
Thanks in advance
Gerber Scientific Products
Senior Software Engineer
Phone: 860 648 8151
Fax: 860 648 8214
83 Gerber Road West
South Windsor, CT 06074
I have to ask the programmer of the main app some questions.
The module state stuff can affect CWnd pointers across the EXE/DLL
module boundary depending on the type of DLL. This needs to be managed correctly.
The CHandleMap is related to the module state. Your CView is in the EXE's map but in the
DLL function, you've changed the module state, so when the callback is called, the
code on the EXE side isn't finding the CView object in the DLL's map.
That's why the type of DLL is important. With a properly initialized extension DLL,
you don't need to use the AFX_MANAGE_STATE macro. Using an MFC extension DLL
is definitely the best/easiest for passing CWnds back and forth across the EXE/DLL boundary.
The drawback to an extension DLL is it can't be used by a non-MFC EXE.
If you must use a standard DLL, then you'll need to manage the module state for
I meant implementing or coding. The point i am trying to express if that i have tested the application within Microsoft visual studio 2003 and it works great. Now i would like to run the application outside the development environment.
Oh! hmm, well haven't you ever opened your project folder? Have you seen these folders? "Debug" "Release" ? All the binaries you build will get created there. If your .exe doesn't have any dependency, you can take that .exe straight from the "release" folder and distribute. but it's not the usual case. Even if you do something with MFC, it will become mfc dlls dependant. (assuming you are linking dynamically). So use an installer like "Innosetup" (google for it). it's free and cool. You can deploy apps on the fly.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
lol, indeed i have opened my project folder so many times. I have tried using the '.exe' file from the release folder but i encountered problems and thats why i posted this question. As you said it must have dependencies.
Ok, i will look for Innosetup and try it.
Last Visit: 31-Dec-99 18:00 Last Update: 21-Sep-23 3:47