Click here to Skip to main content
15,920,217 members
Home / Discussions / COM
   

COM

 
GeneralRe: Is COM an 'outdated' technology? Pin
bob1697221-Apr-12 5:52
bob1697221-Apr-12 5:52 
GeneralRe: Is COM an 'outdated' technology? PinPopular
Richard MacCutchan21-Apr-12 7:44
mveRichard MacCutchan21-Apr-12 7:44 
AnswerRe: Is COM an 'outdated' technology? Pin
Eddy Vluggen12-Oct-12 14:05
professionalEddy Vluggen12-Oct-12 14:05 
QuestionIssues with identity of COM+ application Pin
Member 39605603-Feb-12 5:52
Member 39605603-Feb-12 5:52 
AnswerRe: Issues with identity of COM+ application Pin
Member 39605606-Feb-12 2:49
Member 39605606-Feb-12 2:49 
QuestionHow to convert COM proxy-stub dll to type library ? Pin
benjava28-Dec-11 17:35
benjava28-Dec-11 17:35 
AnswerRe: How to convert COM proxy-stub dll to type library ? Pin
Jonathan Davies30-Dec-11 9:08
Jonathan Davies30-Dec-11 9:08 
AnswerRe: How to convert COM proxy-stub dll to type library ? Pin
«_Superman_»6-Jan-12 16:23
professional«_Superman_»6-Jan-12 16:23 
QuestionOPENING THE VBA EDITOR ON CLICK ON OLEOBJECTS BUTTON Pin
archana jain15-Dec-11 0:20
archana jain15-Dec-11 0:20 
QuestionHow to select the predefined area as WIDTH in PIXEL by HEIGHT IN PIXELS in MSEXCEL for desiging your templates Pin
archana jain14-Dec-11 22:18
archana jain14-Dec-11 22:18 
QuestionAdding Workbook In Excel Pin
SB_CodeForFun6-Dec-11 20:02
SB_CodeForFun6-Dec-11 20:02 
QuestionNeed Com Help - I'm a beginner Pin
jkirkerx6-Nov-11 8:48
professionaljkirkerx6-Nov-11 8:48 
AnswerRe: Need Com Help - I'm a beginner Pin
«_Superman_»6-Nov-11 15:36
professional«_Superman_»6-Nov-11 15:36 
GeneralRe: Need Com Help - I'm a beginner Pin
jkirkerx6-Nov-11 19:34
professionaljkirkerx6-Nov-11 19:34 
GeneralRe: Need Com Help - I'm a beginner Pin
jkirkerx9-Nov-11 7:36
professionaljkirkerx9-Nov-11 7:36 
QuestionHow to use unregistered tlb file Pin
SB_CodeForFun30-Oct-11 23:54
SB_CodeForFun30-Oct-11 23:54 
AnswerRe: How to use unregistered tlb file Pin
DriveByCoder24-Mar-15 7:48
professionalDriveByCoder24-Mar-15 7:48 
QuestionCOM Component Late binding trouble Pin
nilarya25-Aug-11 6:28
nilarya25-Aug-11 6:28 
Hi All,

I have posted this message earlier on the ASP.Net forum, I did not notice there is a separate forum for Co Componenets. However I am moving the post to here, please have a look, any help would be much appreciated.

I am using a third Party Com Component in my ASP.NET application. I dont have much experience with COM Components and I think I have messed up here. Please help.

The Com component has a method which looks like following in the ILDASM:

.method public hidebysig newslot specialname virtual
instance class [stdole]stdole.IPicture
marshal( interface )
get_Preview([in] float64 rWorldMinX,
[in] float64 rWorldMinY,
[in] float64 rWorldMaxX,
[in] float64 rWorldMaxY,
[in] int32 dwPicWidth,
[in] int32 dwPicHeight,
[in] int32 PicType) runtime managed internalcall

In my code behind, I am using


C#
object ComObjLateBound;
Type ComObjType;
ComObjType= Type.GetTypeFromCLSID(new Guid("{89251546-3F1C-430D-BA77-F86572FA4EF6}"));
ComObjLateBound= Activator.CreateInstance(ComObjType);
 
//getting the values from the properties. The properties are in the Com Component 
double viewMaxX = (double)ComObjType.InvokeMember("ViewMaxX", BindingFlags.Default | BindingFlags.GetProperty, null, ComObjLateBound, new object[] { });
double viewMaxX = (double)ComObjType.InvokeMember("ViewMaxY", BindingFlags.Default | BindingFlags.GetProperty, null, ComObjLateBound, new object[] { });
double viewMaxX = (double)ComObjType.InvokeMember("ViewMinX", BindingFlags.Default | BindingFlags.GetProperty, null, ComObjLateBound, new object[] { });
double viewMaxX = (double)ComObjType.InvokeMember("ViewMinY", BindingFlags.Default | BindingFlags.GetProperty, null, ComObjLateBound, new object[] { });
 
//geting the image height and width from a local file
int imagewidth, imageheight, pictype;
imagewidth = 1280; imageheight = 800; pictype = 1;
 
object[] previewDetails = new object[7];
previewDetails[0] = viewMinX;
 
previewDetails[1] = viewMinY;
 
previewDetails[2] = viewMaxX;
 
previewDetails[3] = viewMaxY;
 
previewDetails[4] = imagewidth;
 
previewDetails[5] = imageheight;
 
previewDetails[6] = pictype;
 
 
IPicture picture = (IPicture)ComObjType.InvokeMember("get_Preview", BindingFlags.Default | BindingFlags.InvokeMethod, null, ComObjLateBound, previewDetails);



this fails with a COM Exception like

{"Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))"}

with an ErrorCode of -2147352570 if that means something.

Now this is strange, because the exception type and Error Code remains exactly the same if I use any name instead of "get_Preview".

the COM component also has a Preview Property which looks the following in ILDASM:

.property class [stdole]stdole.IPicture Preview(float64,
float64,
float64,
float64,
int32,
int32,
int32)
I have also tried to use this property to get the IPicture value like:

C#
IPicture picture = (IPicture)ComObjType.InvokeMember("Preview", BindingFlags.Default | BindingFlags.GetProperty, null, ComObjLateBound, previewDetails);


But it also falis with a message that Exception has been thrown by the target of an invocation.

Please note, I am not able to use early binding on this component as it gives me an error message -

Unable to cast COM object of type '<>' to interface type '<>'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{}' failed due to the following error: No such interface supported.

I think I am doing something wrong here. Can you please point out what it is?

Thanks in advance.

AnswerRe: COM Component Late binding trouble Pin
tom-englert21-Sep-11 1:20
tom-englert21-Sep-11 1:20 
GeneralRe: COM Component Late binding trouble Pin
nilarya6-Oct-11 23:27
nilarya6-Oct-11 23:27 
GeneralRe: COM Component Late binding trouble Pin
tom-englert7-Oct-11 3:59
tom-englert7-Oct-11 3:59 
GeneralRe: COM Component Late binding trouble Pin
nilarya7-Oct-11 22:46
nilarya7-Oct-11 22:46 
GeneralRe: COM Component Late binding trouble Pin
nilarya7-Oct-11 22:57
nilarya7-Oct-11 22:57 
GeneralRe: COM Component Late binding trouble Pin
nilarya23-Oct-11 23:27
nilarya23-Oct-11 23:27 
GeneralRe: COM Component Late binding trouble Pin
tom-englert7-Nov-11 6:23
tom-englert7-Nov-11 6:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.