|
Here i give sample,
typedef CComPtr<ICalPktInternal> IntCalPktComPtr;
typedef list< CAdapt<IntCalPktComPtr> > CalPktList;
CalPktList m_List;
CalPktList::iterator it;
for (it = m_List.begin(); it != m_List.end(); it++)
{
IntCalPktComPtr pInt;
CComPtr<IUnknown> pUnk;
pInt = *it;
pInt->QueryInterface(&pUnk); // This line crash
...
}
While crash the pInt value is NULL. Is any possibility to hold NULL value in CComPtr and store in vector list?
|
|
|
|
|
Hi,
I create a COM dll using ATL COM Wizard. In this application i want to access a database(ms access file name.mdb). In this dll i create a new component say "MyComponent" so its class will be CMyComponent. In FinalConstruct() method of this component i wrote following code
HRESULT FinalConstruct()
{
HRESULT hr ;
CoInitialize ( NULL ) ;
hr = myptr.CreateInstance ( __uuidof ( MyComponent ) ) ;
hr = myptr->Open ( _T ("Provider = Microsoft.Jet.OLEDB.3.51; Data Source=path of mdb file"), "", "",adConnectUnspecified ) ;
return hr;
}
where myptr is of type _ConnectionPtr which is defined in class CMyComponent. In stdafx.h file i import ado dll and another file
#include "atlcom.h"
#import "C:\\Program Files\\Common Files\\System\\ado\\msado15.dll"
Now when i use this com dll i get error. and the reason is myptr->Open function is fail to open the database. This function returns failure value.
Please suggest how to open this access file using ADO.
Manoj Kumar Chauhan
|
|
|
|
|
I post this question before 3-4 days
I did not get any reply
Please explain how to fix error which comes when we open database through ADO
Manoj Kumar Chauhan
|
|
|
|
|
I got the error. The reason was following in open function
Provider = Microsoft.Jet.OLEDB.3.51
And i replace it by
hr = myptr->Open ( _T ("Provider = Microsoft.Jet.OLEDB.4.0; Data Source=path of edb file"), _T(""), _T(""),adOpenUnspecified ) ;
Where is the option to know about OLEDB version
Manoj Kumar Chauhan
|
|
|
|
|
Get data from serial port
|
|
|
|
|
Are you confusing serial port with C omponent O bject M odel?
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
|
|
|
|
|
No, I need to read data from serial port using ATL COM
|
|
|
|
|
Do you need to build a COM component or do you need to access MSComm ?
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
|
|
|
|
|
|
And what are your doubts? Do troubles comes from COM programming or serial port API (i.e. be specific)?
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
|
|
|
|
|
I dont know how write program for reading serial port data using Component Object Model. I am searching for the program.
|
|
|
|
|
Well, good luck.
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 5
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
|
Possibly he appreciated my reply and voted me 5 .
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
|
|
|
|
|
|
This application is in Delphi, but question isn't language specific.
I've created an exe application, normally when you run it, it sets up some variables then shows the main form, no problem there.
I've also created automation objects in the application so it can be use as an out-of-process automation server.
When a client calls the methods in the automation object, I do not want the main form to show, how do I do that?
I can't tell whether the application is being use as standalone exe, or as an automation server, so every time it gets called, the main form shows up. How do I not show the form when the application is being use as an automation server?
|
|
|
|
|
Hi
I dont really know COM (or C++ for that matter). I want to implement the ICorProfilerCallback2 interface. The question is, do I need to implement every method in the COM interface? Also, is there some 'magic menu' like in C# where you can simply generate the stubs for the interface (if indeed the whole thing needs to be implemented).
Cheers
leppie
|
|
|
|
|
leppie wrote: I dont really know COM (or C++ for that matter). I want to implement the ICorProfilerCallback2 interface. The question is, do I need to implement every method in the COM interface?
Yes, it is mandatory (general requsite of all COM interfaces). I mean you have to implement all of the methods in the correct order. Anyway you can make empty methods.
leppie wrote: Also, is there some 'magic menu' like in C# where you can simply generate the stubs for the interface (if indeed the whole thing needs to be implemented).
I don't know.
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
|
|
|
|
|
CPallini wrote: Yes, it is mandatory (general requsite of all COM interfaces). I mean you have to implement all of the methods in the correct order. Anyway you can make empty methods.
Thanks, it's a huge interface though I was hoping to use only a little of it.
|
|
|
|
|
Good luck.
Have you checked out this [^]?
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
|
|
|
|
|
CPallini wrote: Have you checked out this [^]?
No I didnt! Thanks for the link, maybe I can use that code better
|
|
|
|
|
A quick thought - Could you not use COM Aggregation instead of implementing the whole interface. This way you can specialize the methods you want and delegate the remaining to orignial interface implementation server?
Aggregation(COM)[^]
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
See here [^].
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
|
|
|
|
|
Yeah saw that after posting my reply. I am at work, so didn't read complete thread.
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|