|
Hi everyone!
I'm using CDatabase & CRecordSet (ODBC in MFC) and I wonder how can I save the content of an RichEdit control as a record (or better to say: a field) in MS-Access database (*.mdb).
Thank you masters!
|
|
|
|
|
You probably want a field that's a BLOB type (I guess Access would call that Attachment type?), then you can just store the raw bytes of the CRichEdit control (accessed via the CRichEditCtrl::StreamIn [^] and CRichEditCtrl::StreamOut [^] methods) in that field, specifying some of your code in the pfnCallback field of the EDITSTREAM [^] structure you pass to the method.
Of course, you could just store the text (as opposed to the rich text, but accessed via the same methods) in a sufficiently large Text field.
|
|
|
|
|
Access has a OLE Object field type. That is used to hold large, binary data.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi all,
U want to extract text from the ms word document using vc++
Can anybody please help me
Thanks in advance
|
|
|
|
|
AVIHAR wrote: U want to extract text from the ms word document using vc++
No
AVIHAR wrote: Can anybody please help me
Search for "Word Automation" @ GOOGLE[^]
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Import Word's type library into your project. This will add a bunch of Word-related classes to your project. Then you can start with something like:
_Application app;
if (app.CreateDispatch("Word.Application") == TRUE)
{
Documents docs = app.GetDocuments();
_Document doc = docs.Open(COleVariant("thesis.doc"), vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional);
docs.Close();
app.Quit();
}
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I am writing an application using C++ and MFC. A few weeks ago, I wrote the following
line of code:
<br />
IMPLEMENT_SERIAL( CMainWindow, CFrameWnd, 1 )<br />
The code worked. The class CMainWindow has only one constructor and that constructor does not take any arguments. Today, I changed that constructor to take a single argument, a reference to an
fstream object. Now, I get the following error messages from the compiler on the line shown above.
There error messages are:
<br />
error C2512: 'CMainWindow' : no appropriate default constructor available<br />
error C2758: 'CMainWindow::debugFile' : must be initialized in constructor base/member initializer list<br />
Note that debugFile is the name of the formal parameters for the constructor CMainWindow. I would
really like to be able to serialize the class CMainWindow and at the same time, I would like the class constructor to take one argument. What should I do?
Thanks
Bob
|
|
|
|
|
You should follow the 'suggestions' of the two errors, in order to make your class serializable again.
For instance, the documentation [^] states
Defining a Constructor with No Arguments
MFC requires a default constructor when it re-creates your objects as they are deserialized (loaded from disk). The deserialization process will fill in all member variables with the values required to re-create the object.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote a very nice version of "Tough".
The serialisation mechanism is very good for simple objects, but I've found it to be very fragile when you want to do any real work. I know others here disagree with me on this though!
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Thanks for the responses. It seems to me that the MFC serialization approach is less then ideal. I solved the problem by making the argument to the constructor optional. This is also less than ideal it gets the job done.
Bob
|
|
|
|
|
i have a question of how to creat a poolObject
this is the code :
template<class t="">
class objectPool : public GenericObjectPool
{
static objectPool<t> *thePool;
static void createPool()
{
thePool = new objectPool<t>();
//here we need to create the pool itself ...
//or in the c'tor of the parent ..
//the register could happen in the c'tor of the parent
//but we either do it here
....
}
}
can someone help me ?
|
|
|
|
|
Sorry - where does GenericObjectPool come from? It's not from MFC, that's for sure...
|
|
|
|
|
I think its better to user a Singlton class if you need only one Object pool and create the Pool in its constructor.
If you need multiple object pool use a Class Factory. any way you can create pool in its constructor.
What is the GenericObjectPool, and what it does?
|
|
|
|
|
Hai,
Please tell me how can i obtain the list of hardware installed in a particular system using Win32 API using VC++. I know that all the information about the system such as memory management, file management are present in WIN32API. But i am not able to obtain those info. I visited msdn. But i just need an idea of how to program using the available info.
|
|
|
|
|
SetupAPI provides methods for getting hardware details. Have a look at that.
|
|
|
|
|
Thank You..I looked at it..But i am doing a project on obtaining these info from system using C functions and Win32 API functions. I need the functions so that i can proceed with my work. I am a novice in this area.
|
|
|
|
|
You could obtain information from the registry such as that under HKEY_LOCAL_MACHINE/System/Enum/, though it may be hard work to do so depending on how much information you want. Though be careful not change anything in the registry!
|
|
|
|
|
aaasrgm wrote: But i am doing a project on obtaining these info from system using C functions and Win32 API functions
Setup API is a Win32 API.
Just add:
#include <setupapi.h>
#include <spapidef.h>
#ifdef _MSC_VER
#pragma comment(lib, "Setupapi.lib")
#endif
It will even work from a console application.
Best Wishes,
-David Delaune
|
|
|
|
|
Have a look at this article[^].
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hey everybody
I'm trying to write a dump using MiniDumpWriteDump(), the function fails with the error 0xD0000022.
I'm trying to find out what that error means, but I can't find anything about that error code.
Does anyone know what it means?
Thanks!
|
|
|
|
|
Did you see this in MSDN?
Return Values
If the function succeeds, the return value is TRUE; otherwise, the return value is FALSE. To retrieve extended error information, call GetLastError. Note that the last error will be an HRESULT value.
If the operation is canceled, the last error code is HRESULT_FROM_WIN32(ERROR_CANCELLED).
Perhaps you should call GetLastError
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Hey, thanks!
And yeah, I did saw it...
Finally I found someone who asked about this problem (in another forum).
He said that newer versions of dbghelp.dll must be used (it seems I didn't use the latest version).
More over, that for full dump (what I want), if the OS failed to make a screenshot, it auto-retries and if failed again,
it simply fails the who process.
|
|
|
|
|
Alternatively, pause your application from within visual studio (I'm assuming that's your IDE of choice) and add a new watch value of "@err, hr"
|
|
|
|
|
Hello everyone,
I am writing a managed console application which will invoke native C++ COM DLL on Windows Server 2003 x64 using PIA interop. The managed console application is built for "Mixed Platform" debug version and the native COM DLL is built for x64 debug version. I am using interop to invoke method from managed code which are exposed from COM code.
I find creating a COM coclass object in managed code is ok, and it is also ok to call some methods of COM coclass from managed code using the created coclass object instance. But when I call into a specific method Abc (Abc is implemented/exposed in COM DLL) from my managed code (FooImpl.dll), there is exception like this, I am so confused that I did not write any method called "XmlSerializers". Any ideas to debug further?
(FooImpl is my managed code DLL which will call COM native code, my managed code console application linked with FooImpl.dll.)
--------------------
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in FooImpl.dll
Additional information: Could not load file or assembly 'FooImpl.XmlSerializers, Version=1.0.1121.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
The system cannot find the file specified.
--------------------
regards,
George
|
|
|
|
|
George_George wrote: An unhandled exception of type 'System.IO.FileNotFoundException'
It seems you dont have the file and it refers to it.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|