Ashok,
thank you for the answer. All your analysis is correct.
The only issue is,
Am 18.04.2018 um 07:41 schrieb Ashok:
> So your problem boils down to passing that last output parameter to the
> Print method. I'm not sure about tcom, but in twapi either the name of
> an unset variable or passing [outvar varname] is supposed to do the trick.
>
> Something like
> unset -nocomplain msgs
> $btFormat Print "Job1" 1 -1 msgs
So, some tries:
% $StateRun(COM_hDocu) -call Print "Job1" 1 -1 [twapi::outvar varname]
Parameter error. Offending parameter position 4. Typenkonflikt.
% set msgname [twapi::outvar lmsgs]
lmsgs
% $StateRun(COM_hDocu) -call Print "Job1" 1 -1 msgs
Parameter error. Offending parameter position 4. Typenkonflikt.
% unset -nocomplain msglist
% $StateRun(COM_hDocu) -call Print "Job1" 1 -1 msglist
Parameter error. Offending parameter position 4. Typenkonflikt.
When I search the output of "generate_code_from_typelib" for "Print", I get:
::twapi::dispatch_prototype_set {{A27F12A1-4305-11D2-BE48-004005A04EDF}}
Print 0 1 {48 0 1 {29 50334848} {{8 {49 {8 {}}}} {11 {49 {11 1}}} {3 {49
{3 -1}}} {{26 {26 {29 coclass
{{2B52174E-AAA4-443D-945F-568F60610F55}}}}} {50 {3 0}}}} {PrintJobName
WaitForSpoolJobToComplete TimeoutMs Messages}}
The interface of Messages is:
# Dispatch Interface IBtMessages
# IBtMessages Methods
::twapi::dispatch_prototype_set {{365EE8DD-7FBD-44CC-8BCA-FF81E54FDF9B}}
QueryInterface 0 1 {1610612736 0 1 24 {{{26 {29 record
{{00000000-0000-0000-0000-000000000000}}}} 1} {{26 {26 24}} 2}} {riid
ppvObj}}
...
and the created creator is:
# Coclass Messages
twapi::class create Messages {
superclass ::twapi::Automation
constructor {args} {
set ifc [twapi::com_create_instance
"{2B52174E-AAA4-443D-945F-568F60610F55}" -interface IDispatch -raw {*}$args]
next [twapi::IDispatchProxy new $ifc
"{2B52174E-AAA4-443D-945F-568F60610F55}"]
if {[string length "{365EE8DD-7FBD-44CC-8BCA-FF81E54FDF9B}"]} {
my -interfaceguid "{365EE8DD-7FBD-44CC-8BCA-FF81E54FDF9B}"
}
}
}
I don't see, that it is output only. The documentation says, that it is
input/output, but must be passed in as uninitialized object.
VB.net example:
Dim btMsgs As BarTender.Messages = Nothing
btFormat.Print("Job1", True, -1, btMsgs)
C# example:
BarTender.Messages btMsgs;
btFormat.Print("Job1", true, -1, out btMsgs);
Interesting is the "out" keyword here.
Some other tries:
% set hMsg [twapi::tclcast empty ""]
% $StateRun(COM_hDocu) -call Print "Job1" 1 -1 hMsg
also with
% set hMsg [twapi::vt_empty]
% set hMsg [twapi::vt_null]
I suppose, the input type should be "VT_DISPATCH" or "VT_UNKNOWN", but
there is no TCL version for that.
I tried to find out what the equivalent in C++ of the examples in VB/C# is.
This pages says that VB Nothing is vt_empty:
https://docs.microsoft.com/en-us/dotnet/framework/interop/default-marshaling-for-objects
ok...
Anyway, no step further so far.
Thank you anyway,
Harald