|
Hi,
Did you come up with a solution to this problem cause I have reached the exact same situation?
/Tommy
|
|
|
|
|
I have declared the class CMyDoc like this :
"class CMyDoc : public COleServerDoc, public CMyClass"
Definition of class CMyClass :
"class CMyClass {
protected :
double mAge;
COtherClass mOtherClass; //(not derived from a CObject
class)
}"
the serialization of members like mAge works correctly, but when I want serialize class members like mOtherClass, the compiler send me the following error :
"error C2678: binary '<<' : no operator defined which takes a left-hand operand of type 'class CArchive' (or there is no acceptable conversion)".
How can serialize such members, must I make the class COtherClass serializable ?
thank in advance for your help.
Fred.
Fred
|
|
|
|
|
You have two options:
1) create an operator<< which accepts a reference to COtherClass as 2nd parameter
2) 'manually' serialize data members of COtherClass in CYourClass::Serialize. In this solution, CYourClass needs an access to COtherClass members, directly or through accessor/mutator methods.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thank for your fast response, but can you be more explicit in your soluces.
I have joined here fragments of my aplication :
//class CMyDoc :
void CMyDoc::Serialize(CArchive& ar)
{
COleServerDoc::Serialize(ar);
if (ar.IsStoring()){
ar << mAge;
ar << mOtherClass;
}else{
ar >> mAge;
ar >> mOtherClass;
}
}
//*********************************************************
class CMyClass
//**** operator << ****
ostream& operator << (ostream &os, CMyClass &pClassTest )
{
os << "Classe " << pClassTest.mAge << endl
<
|
|
|
|
|
I have a property sheet with several pages present in it.
On one of the pages, it is necessary to update another 2 pages if I make a certain change, to have it reflected on the other pages if I tab to them.
This seemed like a candidate for a user defined message to all the pages of the sheet, so each page could either notice or ignore the action and take whatever action is required.
My first attempt was in the propertypage code, a new message handler
#define UWM_NEWROWCOL (WM_USER + 1)
ON_MESSAGE(UWM_NEWROWCOL, OnNewRowCol)
implementation
LRESULT CDragDataPage::OnNewRowCol(WPARAM wparm, LPARAM lparm)
{
TRACE("Drag New Row/Col %d %d\n", wparm, lparm);
return 1;
}
then to send the message I've tried:
CWnd *parent = GetParent(); // parent of the propertypage is the propertysheet??
parent->PostMessage(UWM_NEWROWCOL, UWM_NEWROW, cell.row);
and
parent->SendMessageToDescendants(UWM_NEWROWCOL, UWM_NEWROW, cell.row, TRUE, TRUE);
The 2nd version occasionally succeeds, in calling the handler for the page its being sent from (but not always), but not usually for the other pages of the sheet with similar registered handlers. If I set a breakpoint on the SendMessageToDescendants it sometimes works, but it pretty random.
I'm sure I'm doing something stupid here. Question is what
Julian.
|
|
|
|
|
Other property pages may have not been fully constructed when you send the message. By default, property sheet creates a window (HWND) when you activate given page. If you want to create all HWNDs for property pages during initialization, use PSP_PREMATURE flag.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Brilliant - thats what the problem was. Many thanks!!!
Julian.
|
|
|
|
|
Hi,
I'm developing an application and I would like it to utilise a WebBrowser control. I would like to control the scroll bars and border styles programatically, only the Microsoft control does not appear to allow access to these properties.
Are there any alternative controls out there?
Matthew
|
|
|
|
|
Hello everybody,
I have a big problem.
I can't execute an executable file in witch i call class import
from two dll.
When i launch my exe the error:
0xC000000FD:Stack overflow
appear.
What can i did for such a problem?
Thanks for help.
|
|
|
|
|
Stack overflow usually means that you have infinite recursion in your program. Have a look at Call Stack debug window when your program crashes - you'll see where's the problem.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I found how to avoid this.
But i know now how to increase the stack size with /STACK in link menu.
|
|
|
|
|
Does SetCurrentDirectory() in CFtpConnection throw any exceptions?
Law is meaningless without chaos.
Chaos without Law is equal to destruction.
Chaos and Law create our rich and colorful world.
|
|
|
|
|
The docs say
Returns Nonzero if successful; otherwise 0. If the call fails, the Win32 function GetLastError may be called to determine the cause of the error.
Looking through the FTP code, there doesn't seem to be any code to throw an exception.
Michael
|
|
|
|
|
But when I use SetCurrentDirectory in CFtpConnection calss, I sometimes got a error message from WININET.DLL and KERNEL32.DLL. I don't know why. Could you explain it?
Law is meaningless without chaos.
Chaos without Law is equal to destruction.
Chaos and Law create our rich and colorful world.
|
|
|
|
|
Hello fellow programmers,
I was wondering how a program like Dr.Watson is hooked into the exception handling mechanism.
This question actually has a background:
For my next project, they've asked me to do some bug-hunting in a HUGE (multi threaded) service process (netto > 1 mil. lines of code over 10.000 files). This peace of code (telecommunication related) has been ported from embedded system, and NO active usage of structured exception handling is used (more C than C++ oriented).
The problem is that in some situations an exception occures, and we want to be able to produce *any* possible kind of info. But since the Windows NT exception handling mechanism is taking over everything, no way of getting some runtime-info. And also: it is a service process, so no interface to user exists.
My idea was to implement a kind of 'general exception handling' function within our application, dumping possible information to a file.
Other suggestions are also welcome, or links to site/topics regarding this topic.
Cheers,
EiSl
|
|
|
|
|
Buy John Robbins Debugging Applications (Microsoft Press). I've read it once, so I know it covers everything you want to know and more, but I've not had enough time to read it often enough to actually answer the question without looking it up. I doubt I could do it justice in any case, you need this book.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
> I was wondering how a program like Dr.Watson
> is hooked into the exception handling mechanism.
It's actually a debugger. I suggest reading April 1997 issue of MSJ; there's a column titled 'Under The Hood' by Matt Pietrek. The article presents a way to set the default exception filter per-thread basis. It should be in your VC++ help (look in the 'Periodicals' section), if it's not there, go to MSDN Online.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I was wondering how to create a simple grid, using the win32 api only.
Dont want to use MFC or something like that. I cant find any predefined
control classes like BUTTON, EDIT and so on to pass in to CreateWindow()..
So howto do it?
|
|
|
|
|
There is no grid control provided with VC except as an OCX. You'll need to create a window, draw it yourself and respond to messages yourself. Chris has done an excellent job of doing this with MFC, and others have ported it to WTL, all available on the site.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Oh.. Well, I started to expect that. I'm used to c++ builder, were you got a grid control just a mouseclick away, now I'm going to port a project to windows ce, cant use builder then... The MFC grid by Chris looks great, but a bit to complex for my needs... Not sure it would run on ce without some changes.
I'm leaning towards just stacking some edit controls together and doing some functions to achieve grid type functionality.
|
|
|
|
|
I think that the grid control has already been converted to run on CE.
Michael
|
|
|
|
|
Hi !!
I have this DLL in which i the global system hook procedure. also there is an installing and an uninstalling function which i have exported and use it in a separate EXE. i am not going in for shared data segments coz only my process is gonna use this hook.
now i have declared a global flag in the DLL which i want the hook to set upon invocation. now the hook is invoked but it does not set the flag !!
i saw a number of examples on hooks but all examples use PostMessage(). the thing is that i don't want to communicate with the server. i just want to set a global variable in the DLL using the hook, so PM() doesn't make sense.
could you plz suggest something??? i am in dire straits
regards,
Faiz.
|
|
|
|
|
Use #pragma data_seg. More details in MSDN and in KB article Q125677.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Do functions in CSocket class throw exceptions?
Law is meaningless without chaos.
Chaos without Law is equal to destruction.
Chaos and Law create our rich and colorful world.
|
|
|
|
|
Yes, at least searching through MFC source shows an AfxThrowResourceException() in CSocket::PumpMessages(), and other AfxThrow*()s in CAsyncSocket and CSocketFile code.
|
|
|
|