|
This problem in common enough. Use a forward reference like this:
class B;
class A
{
public:
A(const B &other);
};
class B
{
public:
B(const A &other);
};
A::A(const B &other)
{
}
B::B(const A &other)
{
}
Steve
|
|
|
|
|
I think I tried this before, but where I went wrong was trying to access members of the class before it was defined. Using your code as an example, in the constructor declaration you have in A I used something like B.variable1 and B.variable2. (Actually I was using a pointer instead of &other but I don't think that matters.) So correct me if I'm wrong, but it seems that you are declaring your constructors w/in the class defintions but defining them outside where it is possible to use the class members?
Thanks for your help on this.
-Harold
|
|
|
|
|
|
Some time it will error, cannot not display page, how to fix?
Thanks.
|
|
|
|
|
Try reinstalling full MSDN again.
Regards,
Paresh.
|
|
|
|
|
I have build SDI using MFC. I would like to have a static text display area on main CMyFrame::CFrameWnd class so I can output text message to this area. How can I do it? Thanks.
|
|
|
|
|
Why CMainFrame? Where to put the static ctrl? Note that main frame consists of the a title bar, menu bar, tool bar and status bar. And the remaining part is the view (CView derived). So, where to put the control?
--
=====
Arman
|
|
|
|
|
I mean I have SDI frame window and I would like to put up a static area on the this frame I guess I don't need the control for the static text area where i only use to put my text strings for user to see. How can I do it in MFC? or better how can i use CSplitter class to split this SDI frame to multiple area?
|
|
|
|
|
I'm trying to play wav files. I've successfully played the registered windows sounds (SystemAsterisk, SystemExit, etc.) using PlaySound() with the SND_ALIAS flag. However, I want to access the Explorer sounds (particularly the Start Navigating "Click" sound). Does anyone know how this is supposed to be done?
|
|
|
|
|
I think you need to read the registry to get the actual filename associated with the event, then pass the filename to PlaySound. For Start Navigating it's HKEY_CURRENT_USER\AppEvents\Schemes\Apps\Explorer\Navigating\.current.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Thanks.
I've tried this, but I can't seem to read the key properly. I can't seem to read the (Default) value properly. I can read any other key, it seems, but not this one. Currently, I pass NULL and "(Default)" as the values into RegQueryValueEx(), but both return ERROR_INVALID_PARAMETER. I tried opening the "AppEvents\\Schemes\\Apps\\Explorer\\Navigating" key, and then querying the ".Current" value and that didn't work either. I've looked all over trying to figure out what I'm doing wrong. Can you please advise? Thanks.
|
|
|
|
|
Try passing the empty string "" as the name of the value. That's what I've always used.
Judy
|
|
|
|
|
Thanks. It turns out my problem was something else - I wasn't passing in the pointer-to-size required as part of the last parameter. I thought I could ignore it since I didn't need it. However, the API requires it unless the data variable is also NULL. It still made me look for my problem elsewhere. Thanks for you help.
|
|
|
|
|
Hello,
My question is about resizing a child window of a multi document /view application.
If the view displays a big Bitmap and I try to resize it by dragging it with the mouse, the latter is very slow and shows border effects.
So my idea is for example to mouse click on one of the side of the window and while I move the mouse, the window does not resize.
Actually it will resize just after I release the mouse button. The new position will be where I released the mouse. Please note that it is just an idea and any suggestion is very welcome.
I tried to find some articles before posting my question here but I was not successful.
Please could you recommend me a solution or articles explaining how to solve this problem?
I have no specific code to show. I just visited the functions OnCreate, OnInitialUpdate,Onsize, OnDraw and OnEraseBkgnd (this last fct is to avoid flickering).
Many thanks for your answers.
|
|
|
|
|
I'd say you need to implement some kind of clipping so you're not drawing the whole bitmap each time, just the portion which is visible. How are you displaying your bitmap? BitBlt?
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Can someone tell me what function can I use to read an Xml file, from an window form?
Thanks!
|
|
|
|
|
Have you tried TinyXML?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I think it might help to know exactly what you need to do with the XML file after loading it. Do you need to parse it and extract data, add/modify data to it, or simply render (display) it in some way?
Also, you mention "window form", which is damn close to "windows forms", which sounds .NET-ish. If you are asking how to do this on the .NET platform, I suggest asking with more details in a .NET-specific forum (like the C# forum).
Peace!
-=- James Please rate this message - let me know if I helped or not!<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
|
|
|
|
|
I need to extract data from the Xml file.
|
|
|
|
|
If you are using .NET and C++/CLI, you can use the System.Xml namespace to access classes such as XmlDocument and XmlReader to extract XML from a file. If you are using "native" Visual C++, you can use MSXML or XmlLite from Microsoft. Except for XmlLite, there are a lot of articles on Code Project and other sites (Can you Google?). XmlLite is new but their is an article about this or last month's MSDN Magazine. Example code for MSXML is not very plentiful also.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Actually, the C++/CLI forum might be what this poster wants.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
For reading XML file, you need a parser (for eg. MSXML). Get MSXML download from Microsoft.
Refer this[^].
Regards,
Paresh.
|
|
|
|
|
|
Hey code mercenaries,
I'm new to MFC, but I've been hired to update a
Visual C++/MFC application. Mostly going pretty
well, but it wouldn't be any fun if there weren't
at least a few hickups, right?
Basically the application that I am working on is
a quasi complicated app with about a thousand
classes or so, which uses numerous pages/tabs/views/lists
to display some database info.
I am adding a new SQL query class to a payment
calculator class so i can do some new calcs on the
db info.
This is causing a Heap Error:
/////
HEAP CORRUPTION DETECTED: after client block (#4531) at 0x015E51B0. CRT detected that the application wrote to
memory after end of the heap buffer.
/////
The error occurs when I am closing the application,
but I have tracked the source down to the following
line of code:
////
CSetspIsAttachedAuthValid* m_pSetspIsAttachedAuthValid2; ////
Basically the error occurs when this line is inserted
into the code, and does not occur when it is commented
out, regardless of whether I actually use this member
or not in any way. Just adding the above line to the
header file causes the heap error, which occurs on
close of the application.
What could possibly be causing this? Is there some reason
why I can't add a member to an existing class in this
application with out causing an error? i have added
other members to this same class with out trouble.
HUGE thanks - Jason
|
|
|
|
|
You've probably exposed an existing problem.
Is the block number always #4531?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|