tags:

views:

88

answers:

1

Whats the most common way of instantiating VB6 ActiveX controls inside of an Tcl/Tk wrapper application.

Are there performance issues with this setup i.e. around GDI handles?

+3  A: 
  1. Download the ActiveTcl distribution and install it.
  2. Referring to The TclTk wiki Download the tcom library for tcl
  3. The tcom README instructs to copy the tcom folder found in the \lib folder from zip file into C:\Tcl\lib to install the tcom library.

Now create a text file with the .tcl extension containing the following:

# This demo of calling the Fire method on the MyControl VB6 ActiveX control
puts "Hello World";
package require tcom;
set myinstance [::tcom::ref createobject "MyKit.MyControl"];
$myinstance Fire;

Double click the .tcl file to open it using wish.

Another option is to use "Open Tcl" a.k.a. optcl which apparently unlike tcom supports embedding a visual ActiveX component in a Tk based application. The install is similar to tcom (copy the optcl folder into the C:\tcl\lib folder.

Here is the optcl version of the code:

#load optcl
package require optcl
set myinstance [optcl::new MyKit.MyControl];
$myinstance Fire;
PeanutPower