call com object with byref byte parameters in vb.net 
Author Message
 call com object with byref byte parameters in vb.net

I want to call a com object (named DES_ATLLib and written in C) in
vb.net  as follows:

 Dim d As New DES_ATLLib.descomClass()

        Dim acct As String = "123456789012"
        Dim pin As String = "1234"
        Dim b As Byte = 4
        Dim pad As string = "FF"
        Dim result As String

all the params of  DesCalc are byref bytes:
when i hover the mouse over d.DesCalc i get this:
public overridable overloads sub DesCalc(byref acct as byte, byref pin
as byte,byref b as byte,byref pad as byte,byref result as byte)

all these params are pointers to the actual values

The last param (result) will hold the result of a calculation done in
the com object.

how must i call this com object?
in other words, how can i obtain the pointers to each of the above
variables (more specifically the ADDRESS OF the first byte of each
variable) ? This way I can pass these variables to the object.

Or, are there other ways to call the object? like wrapping it? If so,
can I please have as detailed as possible instructions ?  ( I do not
want to spend too much time for this thing...)

thx



Wed, 19 Oct 2005 05:59:01 GMT  
 call com object with byref byte parameters in vb.net
In the declaration of the procedure, the parameters are already defined as
byref, so you don't need to anything to get the address, you can just pass
your variable:

d.DesCalc (acct, pin, b, pad, result)

VB will pass the parameter by address. More information can be found in
MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn...
vaconArgPassMechanism.asp

Thanks,

Yun [MS]


Quote:
> I want to call a com object (named DES_ATLLib and written in C) in
> vb.net  as follows:

>  Dim d As New DES_ATLLib.descomClass()

>         Dim acct As String = "123456789012"
>         Dim pin As String = "1234"
>         Dim b As Byte = 4
>         Dim pad As string = "FF"
>         Dim result As String

> all the params of  DesCalc are byref bytes:
> when i hover the mouse over d.DesCalc i get this:
> public overridable overloads sub DesCalc(byref acct as byte, byref pin
> as byte,byref b as byte,byref pad as byte,byref result as byte)

> all these params are pointers to the actual values

> The last param (result) will hold the result of a calculation done in
> the com object.

> how must i call this com object?
> in other words, how can i obtain the pointers to each of the above
> variables (more specifically the ADDRESS OF the first byte of each
> variable) ? This way I can pass these variables to the object.

> Or, are there other ways to call the object? like wrapping it? If so,
> can I please have as detailed as possible instructions ?  ( I do not
> want to spend too much time for this thing...)

> thx



Wed, 19 Oct 2005 06:41:29 GMT  
 call com object with byref byte parameters in vb.net
already tried that:
I got:
An unhandled exception of type 'System.OverflowException' occurred in
microsoft.visualbasic.dll

Additional information: Arithmetic operation resulted in an overflow.

any ideas please?

Quote:

> In the declaration of the procedure, the parameters are already defined as
> byref, so you don't need to anything to get the address, you can just pass
> your variable:

> d.DesCalc (acct, pin, b, pad, result)

> VB will pass the parameter by address. More information can be found in
> MSDN:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn...
> vaconArgPassMechanism.asp

> Thanks,

> Yun [MS]



> > I want to call a com object (named DES_ATLLib and written in C) in
> > vb.net  as follows:

> >  Dim d As New DES_ATLLib.descomClass()

> >         Dim acct As String = "123456789012"
> >         Dim pin As String = "1234"
> >         Dim b As Byte = 4
> >         Dim pad As string = "FF"
> >         Dim result As String

> > all the params of  DesCalc are byref bytes:
> > when i hover the mouse over d.DesCalc i get this:
> > public overridable overloads sub DesCalc(byref acct as byte, byref pin
> > as byte,byref b as byte,byref pad as byte,byref result as byte)

> > all these params are pointers to the actual values

> > The last param (result) will hold the result of a calculation done in
> > the com object.

> > how must i call this com object?
> > in other words, how can i obtain the pointers to each of the above
> > variables (more specifically the ADDRESS OF the first byte of each
> > variable) ? This way I can pass these variables to the object.

> > Or, are there other ways to call the object? like wrapping it? If so,
> > can I please have as detailed as possible instructions ?  ( I do not
> > want to spend too much time for this thing...)

> > thx



Wed, 19 Oct 2005 19:04:01 GMT  
 call com object with byref byte parameters in vb.net
Sorry, I didn't realize that the prototype of your method in VB is byref
byte instead of byref string. It looks a little bit strange.
I don't know how you write the COM object in C, but the type you use for
string in COM interface should be BSTR (not char*). And VB can recognize
BSTR as string automatically.
Hope it helps.

Thanks, Yun[MS]


Quote:
> already tried that:
> I got:
> An unhandled exception of type 'System.OverflowException' occurred in
> microsoft.visualbasic.dll

> Additional information: Arithmetic operation resulted in an overflow.

> any ideas please?




Quote:
> > In the declaration of the procedure, the parameters are already defined
as
> > byref, so you don't need to anything to get the address, you can just
pass
> > your variable:

> > d.DesCalc (acct, pin, b, pad, result)

> > VB will pass the parameter by address. More information can be found in
> > MSDN:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn...
Quote:
> > vaconArgPassMechanism.asp

> > Thanks,

> > Yun [MS]



> > > I want to call a com object (named DES_ATLLib and written in C) in
> > > vb.net  as follows:

> > >  Dim d As New DES_ATLLib.descomClass()

> > >         Dim acct As String = "123456789012"
> > >         Dim pin As String = "1234"
> > >         Dim b As Byte = 4
> > >         Dim pad As string = "FF"
> > >         Dim result As String

> > > all the params of  DesCalc are byref bytes:
> > > when i hover the mouse over d.DesCalc i get this:
> > > public overridable overloads sub DesCalc(byref acct as byte, byref pin
> > > as byte,byref b as byte,byref pad as byte,byref result as byte)

> > > all these params are pointers to the actual values

> > > The last param (result) will hold the result of a calculation done in
> > > the com object.

> > > how must i call this com object?
> > > in other words, how can i obtain the pointers to each of the above
> > > variables (more specifically the ADDRESS OF the first byte of each
> > > variable) ? This way I can pass these variables to the object.

> > > Or, are there other ways to call the object? like wrapping it? If so,
> > > can I please have as detailed as possible instructions ?  ( I do not
> > > want to spend too much time for this thing...)

> > > thx



Sat, 22 Oct 2005 06:23:35 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. call com object with byref byte parameters in vb.net

2. Call VB DLL or COM object from within VB COM object or EXE

3. Calling a com object with variable number of parameters from VB.

4. com object will not read registry when com object called from asp (vb works fine)

5. Calling a COM object from VB.Net with Optional Params

6. Type mismatch when calling VB6 COM objects from VB.NET

7. Calling COM EXE from VB.NET Service leaves COM EXE in Memory

8. COM-Object in ASP with COM-Object as parameter

9. COM-Object in ASP with COM-Object as Parameter

10. Calling VFP COM server with object parameter

11. VB COM object leaks private bytes

12. COM object cloning ByRef

 

 
Powered by phpBB® Forum Software