Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / November 2004

Tip: Looking for answers? Try searching our database.

InvokeMember and "long *val" in COM

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jochen Kalmbach - 24 Nov 2004 20:28 GMT
Hello,

I am trying to do some late binding to an COM-Server.

Now I have the following problem: The IDL-Description of the Method looks
like this:

VARIANT_BOOL StartObjectQuery(
 long ObjectType,
 long* TotalNoOfObjects);

Now I try to execute this method with the following C# code:

 int totalNoOfObjects = 0;
 int objType = 1;
 ParameterModifier pm = new ParameterModifier(2);
 pm[0] = false;
 pm[1] = true;
 ParameterModifier [] pmArray = { pm };
 object res = iobusQuery.GetType().InvokeMember(
   "StartObjectQuery",
   BindingFlags.InvokeMethod,
   null,
   iobusQuery,
   new object[2] {objType, totalNoOfObjects},
   pmArray,
   null,
   null);
 return Convert.ToBoolean(res);

It executes without exception, but the "totalNoOfObjects" is always
unchanged!!!

How can I get the correct value?

Any help is appreciated!

Signature

Greetings
 Jochen

  My blog about Win32 and .NET
  http://blog.kalmbachnet.de/

Jochen Kalmbach - 24 Nov 2004 20:36 GMT
Sorry,

I found it out...

I need to use an args array

object [] args = {objType, totalNoOfObjects};

>   object res = iobusQuery.GetType().InvokeMember(
>     "StartObjectQuery",
[quoted text clipped - 5 lines]
>     null,
>     null);

and then it is in the array:

totalNoOfObjects = Convert.ToInt32(args[1]);

Signature

Greetings
 Jochen

  My blog about Win32 and .NET
  http://blog.kalmbachnet.de/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.