|
Hi,
Can any one tell me how to handle exception in COM or provide me the link where I find the relevent information.
Thanks in advance
Nandu
|
|
|
|
|
Hi Nandu,
COM does not throw exceptions as they are language specific and cannot cross the COM boundary.
What usually happens, especially if using #import (visual C++) is that a thin wraper is made around the COM function call, this detects the HRESULT failure of the COM call and throws an exception itself back to your C++ code.
Other languages may do the same, but non of them throw exceptions accross the COM boundary.
regards,
|
|
|
|
|
Hi Jonathan Wilkes,
So based on HRESULT we have to handle the sutivation.
ok..Thankyou very much.
regards,
Nandu
|
|
|
|
|
Hi Nandu,
Yes, either process the HRESULTS if using straight COM, but if using the Microsoft #import statement then use exception handling as the wrapper created by the #import call will throw exceptions if the HRESULT is not S_OK.
regards,
Jonathan
|
|
|
|
|
what is the perpose of LockServer() in IClassFactiory
|
|
|
|
|
To avoid the COM server deletion whenever the reference count goes to zero. See the MSDN documentation about http://msdn2.microsoft.com/en-us/library/ms682332.aspx[^].
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.
|
|
|
|
|
Hello
I have Created the Simple ATL COM Server (.dll). and put one interface in it(called MyMath) and Add one function called Addition. I also made a simple MFC application to use the function and import the library using import "..\path\_name.lib"> and then initialize the Interface. So It gives the Compile Time Error . So I include two more files. _server.h and _server_i.c and Bam!!! Compile Time Error Gone!!.(server is the name of my ATL SERVER Project )But when I run the Programme it gives me the Run time Error as Below.
the instruction at "0X004139d8"referenced memory at "0z00000000". The memory coult not be "read"
I am Using Visual Studio .Net 2003 for making Application
So Please Help Me.
|
|
|
|
|
For the compile error try this
#import "..\path\_name.lib" no_namespace
« Superman »
|
|
|
|
|
Would you provide some relevant code ?
Prasad
MS MVP - VC++
|
|
|
|
|
Hello,
One thing that you can do is to generate the map file during the compilation and then, reading that, find the line of code that generates the crash.
An excellent article is at url:
www.codeproject.com/debug/mapfile.asp
I don't know if, in your case, my idea can be usefull, but...
|
|
|
|
|
Hello
Im trying to deploy a application created on a machine with Office2007 on a new machine witch is using Office 2003. Im not getting it... I continue getting this error...
Unable to cast COM object of type 'Microsoft.Office.Interop.Word.ApplicationClass' to interface type 'Microsoft.Office.Interop.Word._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00020970-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).
Just wondering if any of you guys know what could be wrong
Cheers
Spaz
|
|
|
|
|
Greetings.
I have created a DLL using the ATL COM AppWizard, and have successfully added a class and functions. I was also successful in create and an expose an enum by including
typedef enum {aa,bb,cc} testEnum;
in the .idl file.
PROBLEM: how do I add definitions of global members? In other words, I would like some constants, variables and functions to be immediately available to VB applications that use my dll, in the same way that the "Load" method or the "App" property become available once the a reference to VB6.olb is created.
Thanks,
zgilboa
|
|
|
|
|
Probaly, this[^] article helps you.
Prasad
MS MVP - VC++
|
|
|
|
|
Thanks. Another thing which I've found out and which solves it is the use of the IDL appobject attribute. Each coclass that has this attribute included in its IDL definition will expose all of its members as global members. Additionally, you could use this attribute with more than one coclass.
[
uuid(483771F3-DD5D-4168-8DC6-CE090E2733F8),
appobject,
helpstring("RefRate Class")
]
coclass RefRate
{
[default] interface IRefRate;
};
zgilboa
|
|
|
|
|
I have a COM dll written using ATL. There is a interface named
"IVehicle". I want to derive 2 new interfaces from this, named
"IToyota" and "IHonda". How can i do that?
The purpose of doing this is that i should be able to use functions
inside both Base interface(IVehicle) from the drived new interfaces.
Thanks in advance.
|
|
|
|
|
donguy76 wrote: How can i do that?
You can do this, same way as simple class,
interface IToyoto : Vehicle
{...
donguy76 wrote: The purpose of doing this is that i should be able to use functions
inside both Base interface(IVehicle) from the drived new interfaces.
You should remember, COM support interface inheritance, not implementation inheritance.
In other words, you need to implement all function inherited by new interface.
Prasad
MS MVP - VC++
|
|
|
|
|
There is question Difference between win32 dll and com dll?
DLL is a comman one there is nothing like win32 dll and COM dll. COM makes use of dll for dynamic linking.
Can you please provide me more information about the same and also Please correct me if I am wrong.
Thanks in advance,
|
|
|
|
|
|
Does anyone have any information about using the function CDefFolderMenu_Create2 to create a standard Explorer context menu for a file? I have been trying in vain to get the correct items in the menu. So far the menu returns 'Cut', 'Copy', 'Create shortcut' and 'Delete' but I need the usual items like 'Send To', 'Properties' etc. I am using IQueryAssociations to return an HKEY but it always returns 0.
I am using C# but any information relating to this command in any language would be very helpful as the MSDN docs are less than helpful and google does not return anything useful.
Thanks
|
|
|
|
|
hi all ,
i m using excel to take a printout on dmp printer and paper is continue sheets . it has no problem at all but i want that the printing starts from the top of the new sheet(this time it is starting after a margin ) automatically after the last sheet is pulled out by the operator.
Nikesh Kr. Yadav
CSS Infotech
Sec- 31
Gurgaon,
Haryana(India)
|
|
|
|
|
Is this question relevant to COM in any way?
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
hi
my first query is how to set the properties in dundas chart
my second query is how to connect these chats to database
my third query is how to write the code
if any one knows pls explain me so tht i gothroww tht
chandrasekhar
|
|
|
|
|
Hi!
I'm developing an application that's burning CD/DVDs using IMAPIv2.0, and need to receive notifications when adding data to the disc image before burning. I've implemented the DFileSystemImageEvents in the same manner as the DDiscFormat2DataEvents interface, but I don't receive any notifications when calling IFsiDirectoryItem::AddTree() on the root directory item retrieved using IFileSystemImage::get_Root().
Also, I call the AddTree() method in a separate thread, COM initialization and pointer marshalling all taken care of (I believe), and the operation for some reason blocks both the separate thread and the primary application thread. But once this operation is done, and I move on to creating result image, retrieving image stream and launching IDiscFormat2Data::Write() (still in the separate thread), the primary thread is unblocked and starts receiving events from the DDiscFormat2DataEvents interface.
This is my how I've implement the interface:
class CIMAPIBurnerImageEvent :<br />
public CIMAPIBurnerEvent,<br />
public ::ATL::CComObjectRootEx<::ATL::CComSingleThreadModel>,<br />
public ::ATL::CComCoClass<CIMAPIBurnerImageEvent>,<br />
public ::ATL::IDispatchImpl<IDispatch, &IID_DFileSystemImageEvents, &LIBID_IMAPILib2, IMAPILib2_MajorVersion, IMAPILib2_MinorVersion>,<br />
public ::ATL::IDispEventImpl<1, CIMAPIBurnerImageEvent, &IID_DFileSystemImageEvents, &LIBID_IMAPILib2, IMAPILib2_MajorVersion, IMAPILib2_MinorVersion><br />
{<br />
DECLARE_NOT_AGGREGATABLE(CIMAPIBurnerImageEvent)<br />
<br />
BEGIN_COM_MAP(CIMAPIBurnerImageEvent)<br />
COM_INTERFACE_ENTRY(IDispatch)<br />
END_COM_MAP()<br />
<br />
BEGIN_SINK_MAP(CIMAPIBurnerImageEvent)<br />
SINK_ENTRY_EX(1, IID_DFileSystemImageEvents, DISPID_DFILESYSTEMIMAGEEVENTS_UPDATE, &Update)<br />
END_SINK_MAP()<br />
<br />
public:<br />
STDMETHOD_(VOID, Update)(IFileSystemImage* fileSystemImage, BSTR currentFile, LONG copiedSectors, LONG totalSectors);<br />
};
This class is hooked up for event listening from the IFileSystemImage interface in the same way as with the DDiscFormat2DataEvents, like this:
m_pImageEvent->DispEventAdvise(m_pFileSystemImage);
To summarize; I don't receive any notifications and both threads are blocked.
What can I possibly be doing wrong?
Regards,
Ole Petter
|
|
|
|
|
|
All,
We have code to call a component remotely from a standard VB.NET Form. I've compiled the code on my machine and it works fine. Calling from another client over the network causes the following error message:
Retrieving the COM class factory for remote component with CLSID {F655F1E8-50B6-31EF-9C5D-B14B7D9B56D3} from machine XP1111 failed due to the following error: 80070005.
The Client Call is made as follows:
Dim svr As Type = Type.GetTypeFromProgID("ZFTestCOMPlus.ZFComPlusOne", _<br />
txtServer.Text) <br />
' txtServer.Text is the name of the server e.g "XP1111"<br />
Dim o As Object = Activator.CreateInstance(svr)<br />
Dim x As ZFTestCOMPlus.ZFComPlusOne = CType(o, ZFTestCOMPlus.ZFComPlusOne)<br />
Dim str As String = x.GetSomeDataFromMe()
The problem occurs on the line Dim o As Object = Activator.CreateInstance(svr).
This is the first COM+ application that has been written here. It is totally client based but users Library COM+ Application (which causes all kinds off issues).
The component is a COM+ Server Application with one class and 2 methods.
Troubleshooting (in the dark) so far...
1. Installed Component into GAC.
2. Created a MSI from COM+ to install the components on remote machine as
a proxy.
2. Added user calling the component from the remote machine to a role
under the COM+ Application. This role has been given access to
ZFTestCOMPlus.ZFComPlusOne class
3. Tried disabling Enforce access checks for this application.
4. Granted full access/remote launch to the user in dcomdnfg in the COM
Security tab.
Anyone have any ideas?
Just fumbling about in the dark at the mo and not come across any decent artices
Andez
|
|
|
|