|
-
Jan 25th, 2007, 09:28 AM
#1
Thread Starter
Member
[RESOLVED] callback from com doesnt work
Hi
I have an activex with some callbacks..How can get my values...??
public abstract virtual System.Int32 GetValue ( System.Int32 myId , System.Object Value )
System.Object Value is the callback...
So..i can do f.ex
int id = 5000;
object a="";
myControl.getValue(id,ref a);
...however, this gives me datatype mismatch..
The callback is supposed to be a "ref object" type, how can i get this to work?
-
Jan 25th, 2007, 06:05 PM
#2
Re: callback from com doesnt work
Methods arguments that require callbacks are delegates in .NET code. You can't pass a string to an argument that expects a delegate. An empty string is not a null value. It is a string with no characters in it, but it is still very definitely a string. If you don't want to p[ass a callback method, assuming that the method you're calling will allow it, then you need to explicitly pass null. Otherwise you need to create an appropriate delegate and pass that.
A callback is a method that gets called from the remote location. In .NET a delegate is an object that contains a reference to a method. You pass the delegate to the method argument and the method it refers to is what gets called from the remote location. If you want more information delegates and their use just search MSDN.
-
Jan 26th, 2007, 03:45 AM
#3
Thread Starter
Member
Re: callback from com doesnt work
Ay, very enlightning :-)
Ill check it out and come back if i still have no clue on what to do
Madsun
-
Jan 27th, 2007, 02:27 PM
#4
Thread Starter
Member
Re: callback from com doesnt work
figured it out... :-)
object a = null;
myControl.getValue(1000,ref a);
That solves it, thanks for the tip!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|