Re: External API (COM) needs bstring



Thank you,

but it does not work. We found the following solution:
we made a wrapper around the dll with C++ and the functions in the wrapper dll work together with the tcom-package from tcl.


palmtcl@xxxxxxxxx schrieb:
AFAIK, when type information for an interface is not available, tcom
makes a best guess based on what the current internal Tcl_Obj type for
the data being passed. This may not always be correct. I've run into
this when the API expected an int but tcom was passing a BSTR because
the Tcl_Obj was a string object. To coerce it to be passed as an int
you had to do something like passing [expr {$var+0}] so the result of
expr would internally be an integer object and be passed as an VT_INT.

In your case, you have the opposite problem I think. Are you passing a
value that is an integer or float, possibly a result of a calculation?
You would need to force Tcl to convert this to a string internally.
I'm not sure exactly how you would do this, but assuming $var holds
the param value to be passed, you could try passing [string range $var
0 end] to the tcom call or perhaps do a

append var ""

and pass $var to the tcom call.

Try that, no guarantees.

/Ashok

On Feb 19, 3:51 pm, Jens <tcl070...@xxxxxxxxxxx> wrote:
That´s correct, I mean the BSTR Type. We use the tcom package that
worked with excel and word very good in different projects.
When we try to call the API function with a string (in the documentation
I read the type is BSTR) we get the following message:
0x80020005 {Type mismatch}

.



Relevant Pages

  • Re: Passing $_REQUEST by reference - sensible thing to do?
    ... The point is that passing by value to a method is not automatically ... $var .= " concatenating a long string" to both functions. ... passing by reference almost always improves ...
    (comp.lang.php)
  • Re: Question regarding use of TStrings as a function parameter
    ... You don't need to use the var parameter if you're passing an object. ... since I'm not passing an object, but a string type: ... procedure TForm1.ChangeMe(var Str: string); ...
    (borland.public.delphi.language.objectpascal)
  • Re: External API (COM) needs bstring
    ... AFAIK, when type information for an interface is not available, tcom ... this when the API expected an int but tcom was passing a BSTR because ... You would need to force Tcl to convert this to a string internally. ... I'm not sure exactly how you would do this, but assuming $var holds ...
    (comp.lang.tcl)
  • A general solution
    ... Split on an array of delimiters; parse a file in one call. ... Hi Gerry,If the string is using comma to separate name and using quotation ... var element; ... Gerry Hickman wrote: ...
    (microsoft.public.scripting.jscript)
  • Re: Calculate the string statement
    ... verkn:(vkn:char; ... funkt:(fkt:string; ... var fkt,dfkt: p; ... var fehler: boolean; ...
    (comp.lang.pascal.borland)