Click here to Skip to main content
15,860,972 members
Home / Discussions / COM
   

COM

 
GeneralRe: Can we calculate/extract Virtual Table address some how from DIA SDK? Pin
glitteringsound5-Nov-10 0:12
glitteringsound5-Nov-10 0:12 
GeneralRe: Can we calculate/extract Virtual Table address some how from DIA SDK? Pin
Richard MacCutchan5-Nov-10 1:52
mveRichard MacCutchan5-Nov-10 1:52 
GeneralRe: Can we calculate/extract Virtual Table address some how from DIA SDK? Pin
glitteringsound5-Nov-10 2:10
glitteringsound5-Nov-10 2:10 
GeneralRe: Can we calculate/extract Virtual Table address some how from DIA SDK? Pin
Richard MacCutchan5-Nov-10 2:27
mveRichard MacCutchan5-Nov-10 2:27 
QuestionQuering a COM object in .net Pin
cable beach19-Oct-10 20:03
cable beach19-Oct-10 20:03 
AnswerRe: Quering a COM object in .net Pin
«_Superman_»19-Oct-10 21:42
professional«_Superman_»19-Oct-10 21:42 
GeneralRe: Quering a COM object in .net Pin
cable beach20-Oct-10 13:26
cable beach20-Oct-10 13:26 
GeneralRe: Quering a COM object in .net Pin
Lim Bio Liong24-Oct-10 20:40
Lim Bio Liong24-Oct-10 20:40 
Hello cable beach,

1.
>> So how can I do this?
>> C# Code:
>> public Void Init(object obj)
>> {
>> string location = obj.Location; // Somehow, without any external references.
>> }

1.1 Unfortunately, this syntax style (indicating a dynamic call to the Location property of a late-bound object) is not possible in C#.

1.2 To make a late bound call to an imported COM object's method or property, you must use the static Type.InvokeMember() function.

1.3 Here are links to 2 useful short articles explaining this :

Calling a COM Component From C# (Late Binding)
http://www.c-sharpcorner.com/UploadFile/psingh/CallingCOMComponentFromCSharp12022005231615PM/CallingCOMComponentFromCSharp.aspx[^]

Late Binding with Reflection
http://www.c-sharpcorner.com/UploadFile/samhaidar/LateBindingWithReflection09122005053810AM/LateBindingWithReflection.aspx[^]



2.

>> VB.net code (this works):
>> public Sub Init(obj as Object)
>> dim location as string = obj.Location
>> End Sub

2.1 Although I do not know enough about VB.NET, I am not surprised that the above syntactic expression is possible. It is likely designed to be so since this is definitely possible in VB6.0.


2.2 I believe that the restriction in C# is probably due to strict type checking which is enforced in languages like C++.


- Bio.
GeneralRe: Quering a COM object in .net Pin
cable beach25-Oct-10 13:17
cable beach25-Oct-10 13:17 
QuestionShell Extension Pin
A_Fa15-Oct-10 18:47
A_Fa15-Oct-10 18:47 
QuestionIHTMLElement2 functions crash in IE7 when scrolling browser control programmatically Pin
castielle_alana15-Oct-10 1:38
castielle_alana15-Oct-10 1:38 
AnswerRe: IHTMLDocument2 functions crash in IE7 when scrolling browser control programmatically Pin
castielle_alana15-Oct-10 1:44
castielle_alana15-Oct-10 1:44 
QuestionCoInitialize return code Pin
alex__b14-Oct-10 23:30
professionalalex__b14-Oct-10 23:30 
AnswerRe: CoInitialize return code [modified] Pin
Sauro Viti14-Oct-10 23:46
professionalSauro Viti14-Oct-10 23:46 
GeneralRe: CoInitialize return code Pin
alex__b15-Oct-10 0:05
professionalalex__b15-Oct-10 0:05 
QuestionInvoke methods in OCX in c# Pin
Viratsaran11-Oct-10 20:18
Viratsaran11-Oct-10 20:18 
AnswerRe: Invoke methods in OCX in c# Pin
«_Superman_»13-Oct-10 20:31
professional«_Superman_»13-Oct-10 20:31 
QuestionConvert document to PDF format Pin
hemananthan15-Sep-10 19:29
hemananthan15-Sep-10 19:29 
AnswerRe: Convert document to PDF format Pin
Member 45243333-Jul-11 22:40
Member 45243333-Jul-11 22:40 
GeneralRe: Convert document to PDF format Pin
Nitin K. Kawale12-Jul-11 0:34
professionalNitin K. Kawale12-Jul-11 0:34 
QuestionGetting an access to idispatch member of idispatch interface Pin
Altankhuu11-Sep-10 21:25
Altankhuu11-Sep-10 21:25 
AnswerRe: Getting an access to idispatch member of idispatch interface Pin
«_Superman_»12-Sep-10 19:21
professional«_Superman_»12-Sep-10 19:21 
GeneralRe: Getting an access to idispatch member of idispatch interface Pin
Altankhuu19-Sep-10 21:56
Altankhuu19-Sep-10 21:56 
AnswerRe: Getting an access to idispatch member of idispatch interface Pin
Lim Bio Liong26-Oct-10 1:38
Lim Bio Liong26-Oct-10 1:38 
QuestionreportAppFactory.OpenDocument throws Invalid Cast exception (No such interfaces supported) [modified] Pin
amitcoder836-Sep-10 17:54
amitcoder836-Sep-10 17:54 

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.