|
Hi,
For some reason the error strings returned from my CRecordset derived class are in German. I am connecting to the datasource using a CDatabase class which connects using the path (DBQ) of the database (access MDB). I then instatiate my CRecordset derived class using the new operator and passing the CDatabase instance. The connection fails and the error code is in german.
Anyone know why this is and what I can do to fix it?
James Spibey
I love the word naked, it's brilliant isn't it, 'naked'. When I was a kid I used to write the word naked on a bit of paper hundreds of times and rub my face in it - Jeff, Coupling, BBC2
|
|
|
|
|
I guess you have specified German language version of driver for MS Access. Select English one and it should be OK.
Martin
|
|
|
|
|
In my work,I have to use the class in the DLL.The DLL is compilered by Borland C++.I have tried my best to do,but each time I have been failed.
What should I do? Now I am doubted whether VC can use the class exporting by other compiler.
If anyone know VC can do it,please tell me how to do it! You can revert or mail: wenxiaoxiao97@mails.tsinghua.edu.cn
Thank you very much!
I am glad to make friends with all of you!
My email is
wenxiaoxiao97@mails.tsinghua.edu.cn
Please mail me.
|
|
|
|
|
The import library produced by MS Visual C++ is in COFF format (Mangled Names), and Delphi and Borland C++ expects things in OMF format.
See the July 1996 "Under the Hood" article of Microsoft Systems Journal. It talks about different dll formats and ways to get round this.
|
|
|
|
|
i have got a problem.. i made an exe - server with atl. if i run it on my or my coworkers pc everything works fine. our atl.dll was added in 1999. if we run our server on a pc with the atl.dll added in 2000 it doesn't work, cause he can't find an entry.. #57 )
we are all using win nt4, and we all have got the same sp (as far as i know)..
do i have to install the latest platform skd, or what could be the problem ?
thanks in advance,
bernhard
"There are three roads to ruin: women, gambling and technicians. The most pleasant is with women, the quickest is with gambling, but the surest is with technicians." Georges Pompidou
|
|
|
|
|
A Workaround would be to statically link ATL.DLL so it is not required.
1. Open the Project Settings dialog box, select the C++ tab. In the Preprocessor Definitions text box, replace _ATL_DLL with _ATL_STATIC_REGISTRY.
2. Recompile.
If the project has been created using the ATL AppWizard, you only need to select the Win32 Release MinDependency option, which has the correct preprocessor definitions for statically linking to the registrar code.
|
|
|
|
|
thank you.. now it works great..
bernhard
"There are three roads to ruin: women, gambling and technicians. The most pleasant is with women, the quickest is with gambling, but the surest is with technicians." Georges Pompidou
|
|
|
|
|
Hi!
MFC have defined their own new, which I found very useful. It prints out if you have some memory leaks when the program exists. In my project, I can't link with the MFC libs since they contain a Dllmain and I have one too.
I tried to create my own new, and that wasn't any problem. Only give som extra arguments through a define. But I must also create a delete. I thought that the delete operator with equal arguments as the new operator, except for vooid * instead of sizt_t, would be called. But instead the global new is called all the time!
I even tried to copy the MFC-way, but still the original global operator new is called!
Anyone who knows?
//Olof Wolgast
|
|
|
|
|
Dear all:
Is anybody here know how could I serialize all elements in a STL container using MFC's serialization and dynamic creation mechanism?
Thank you.
|
|
|
|
|
Write the number of elements first, then iterate through the container to write them. The element count tells you how many to read in when you load.
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
|
|
|
|
|
Thank you Christian. But what you said has only covered Write activity, when you do Read activity, you must new all kinds of objects out and add them into the collection, say a vector.
And more, I need to write my own Archive class and overload the >> and << operator.
Have you got any idea of this?
I'm sure somebody has finished it, but I don't know how to find it.
|
|
|
|
|
That depends on if you have a vector of pointers. If you do, you obviously need to dereference them in writing, and recreate them with new when you push them on to the container.
Why do you need your own archive class ?
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
|
|
|
|
|
Because STL doesn't has a built-in file stream class.
Also, what about the dynamic creation mechanism?
|
|
|
|
|
I was presuming you were using the Serialise method of a CDocument derived class, and iterating through your data, writing it out there.
What do you mean by dynamic creation ?
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
|
|
|
|
|
When you deserialize the object, the object's default ctor will be called up to create a object.;)
|
|
|
|
|
That's what I thought you meant - that's why I suggested writing the count first, then writing out the items, so you can get the CONTENTs of the vector back from the archive and construct the vector yourself.
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
|
|
|
|
|
Christian Graus wrote:
so you can get the CONTENTs of the vector back from the archive and construct the vector yourself.
So, without the dynamic creation mechanism, I must read each items type info, the class name in MFC's implementation, and construct it by myself using a factory class.
Is this what you mean?
|
|
|
|
|
Alex,
Here are some general serialization rules:
- Every object you want to serialize should have a signature and a version #. The signature lets you deserialize it from a persistent collection of heterogenous objects. The version helps you maintain backward compatibility of .dat files.
- Every object you want to serialize should have a serialize method, viz: long serialize (CArchive* pArchive);
- When you serialize an object, first serialize its signature, followed by its version #. Next, serialize all simple members (longs, bools, chars) and standard MFC objects (eg: CString). Finally, serialize each contained custom object.
- If your custom object is a collection (eg: MyEmployeeList), be sure to (de)serialize its size before (de)serializing each member. MyEmployeeList will typically be derived from CPtrArray and can be reconstructed at read time. Ideally, deserializing should use a factory class that serves up the appropriate specialization of Employee, based on the signature read in during deserialization.
- You probably already know this, but serialization can (and imho should) be implemented without those ugly DECLARE_SERIAL and IMPLEMENT_SERIAL macros.
Hope this helps!
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
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
|
|
|
|
|