
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