|
Thank you, Ravi:
Ravi Bhavnani wrote:
You probably already know this, but serialization can (and imho should) be implemented without those ugly DECLARE_SERIAL and IMPLEMENT_SERIAL macros.
Sorry, but I don't know how to implement Serialization without the macro.
Also, could you provide me an example of how to doing that?
|
|
|
|
|
The DECLARE_SERIAL and IMPLEMENT_SERIAL macros come in handy when you want to fit into MFC's doc-view architecture. However, imho you can keep your code general (and therefore less error prone) if you perform serialization manually. You can even still use MFC's doc-view support - just do the serialization yourself.
- In your collection class, add a method like long serialize (CArchive* pArchive);
- When you want to serialize to/from a file, open the file (for read/write as the case may be), create a CArchive object and attach it to the file, and finally pass it to your collection's serialize() method.
- Serialization will "magically" occur (see my previous note) since the top level collection class will delegate the work to its contents, as necessary.
- When you deserialize from an older version of an object, be sure to adjust your "latest version" object as necessary. When you serialize, always save the latest version of the object. For example:
long nVersion << *pArchive;
if (nVersion < CURRENT_VERSION) {
m_someMember = 0;
} else {
m_someMember << *pArchive;
}
The only "drawback" with this method is that you have to do some work to implement a "Save As Old Version" feature in your app. This not so bad, since it's usually enough to be able to *read* older versions of your data.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Dear all,
I have developed an ActiveX control and would like to know the absolute path of this ActiveX. Is there any Windows API available for this?
thanks
|
|
|
|
|
Does anyone have a clue why i might be getting this error msg in my app?
First-chance exception in Client.exe (GDI32.DLL): 0xC0000005: Access Violation.
It is an SDI app that uses splitters and dynamically replaces the panes in the right hand pane with the current view selected from the menu in the lefthand pane ala Outlook.
One of the menu items on the left causes a CHtmlView to be swapped in. When i resize this view at all i get this error msg in the debugger. I know i havent given much information but does anyone off the top of their head know why this could be happening? it only happens with the CHtmlView swapped in not any other.
I got the technique for swapping panes dynamically from a codeguru article that i am currently looking for.. hehe sorry about that.
I also looked at the code for Caroline Englebienne's ( http://www.codeguru.com/splitter/mvSplitter.shtml ) dynamic pane switching demo and when i replace one of the views with a CHtmlView it does the same thing (generates the exceptions) as my app. Is this maybe a standard thing with the CHtmlView or am i doing something wrong?
------------------------------------------------------------
Why take it to the MAX when you can take it to the MEAN!
|
|
|
|
|
Hi all,
How can i sort ComboBox items, programitically ?!
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Does anyone know how to remove the sunken border around a formview that takes up a pane in a CSplitterWnd?
i have been trying to remove the WS_EX_CLIENTEDGE window style and this seems to work in a small test app without splitters but when i do it in my app with splitters it seems to not make any difference.. anyone have a clue why this is? Its really annoying me because i think formviews look damn ugly with that sunken border.
any help is appreciated
ASH
|
|
|
|
|
|
i would really like to remove the border totally so that it looks dialogish but this should be fine
thanks a lot
|
|
|
|
|
I've derived my own version of the CStatic control and I can't make it to right-align text!!!
ModifyEx(0, SS_RIGHT) won't do any good.
I'm sure this is easy but I've spent too much time already on this...
Thanks!
|
|
|
|
|
Why don't you set it in the dialog editor ?
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I did, with no success... perharps I should use SubClassDlgItem???
|
|
|
|
|
You're using the wrong function. Use CWnd::ModifyStyle():
YourStaticWnd.ModifyStyle ( 0, SS_RIGHT );
--Mike--
http://home.inreach.com/mdunn/
While I can't be correct on all matters, I can make the reassuring claim that where I am inaccurate, I am at least definitively inaccurate.
your with and
Sonork - 100.10414 AcidHelm
|
|
|
|
|
Nope, won't work... it returns 0...
|
|
|
|
|
Hello, the codegurus around the world!;)
Did you use IDC_STATIC as the ID of your CStatic control?
IDC_STATIC is defined as the default static ID number.
So, if you do this, try to assign the other ID like IDC_MYSTATIC.
If this didn't work, try to use Create function and assign the properies
with right asignment?
/*********************** *******************************/
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
Masaaki Onishi
/*********************** *******************************/
|
|
|
|
|
I have written an application that uses the MS Flex grid. The grid display on my machine, which I am running VC++, but when I try to run it on a machine that does not have the compiler the dialog with the grid does not display. It acts like I never pushed the trigger for the display. I doesn't get to the OnInit function so I am to guess that it is getting hung on the DDX function. That leads me to believe that I should be distributing a certain file (msflex.dll) in order for this app to work correctly. Does anyone know what that file is?
Thanks in advance
|
|
|
|
|
MSFLXGRD.OCX
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Does someone know how to export/import classes in dll? I wonder if it is possible as in .NET
|
|
|
|
|
Yes it is possible with the use of Microsoft-specific storage-class specifiers __declspec(dllimport) and __declspec(dllexport) , much as it is done for regular functions.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Why is it so difficult to create a docking windows with a tree inside it! WHY WHY!?!?!?
BYE
|
|
|
|
|
Hi,
How do you play a sound at the beginning of an MFC program, without having any user interaction?
Like, how the ICQ program plays a sound at start up.
Thanks
|
|
|
|
|
Um.. ::PlaySound ? Check it out in the MSDN.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I have a control subclassed from CRichEditCtrl that has command handlers for the standard edit commands. This control is declared as a member of a class that is subclassed from CView. The problem is that when the control has the focus, it does not receive any commands.
What's the cleanest way to route commands to the controls on the CView?
It appears that CView doesn't route any commands to its children. I have overridden the CViews OnCmdMsg method and passed messages to the children by calling their OnCmdMsg methods, but this does not work perfectly. Mainly, I can't get the ON_COMMAND_UPDATE_UI stuff to work properly. Any help will be appreciated. Thanks.
|
|
|
|
|
I have a control which displays information in 3 different places on itself. When one piece of information changes, I have to repaint the whole control. Sometimes, only one piece of information changes many times very quickly, so I end up re-drawing the whole control for everytime. Is there a way to mark a region or part of a control that needs to be re-drawn, not the whole thing?
-Mark Lenz
|
|
|
|
|
- Call CWnd::InvalidateRect() and pass it the RECT of the area that needs to be redrawn.
- In your painting code, check the DC's invalid region (it's a CDC or API function, I can't remember the name ATM) and only repaint that region.
--Mike--
http://home.inreach.com/mdunn/
While I can't be correct on all matters, I can make the reassuring claim that where I am inaccurate, I am at least definitively inaccurate.
your with and
Sonork - 100.10414 AcidHelm
|
|
|
|
|
i have a big problem linking a dll.
i thing the functions in the dll are old and are declarated with
__export, and can match this in my prototypes because
VC++ 6 doesn't know what __import is .
1. with lib i make from the dll lib file, which i build with
my project, still no errors
2. then in header files i try to write the prototypes
something like that
extern "C" MTELConnect(...);
the compiler says no, and i use the __declspec(dllimport) also.
it compiles successfully,
but when tries to link
i got the following mistake
error LNK2001: unresolved external symbol __imp__MTELConnect
somebody help me
|
|
|
|