How to call a Windows API function from a TCL script 
Author Message
 How to call a Windows API function from a TCL script

Howdy folks,

I am researching ways to add scripting support to a PC hardware testing
program that runs on Windows 95 and Windows NT. I really don't know
squatt about TCL and I have several questions:

1- Can an API function be called from within the script, like
GetSystemMetrics?

2- Could the script call a DLL function?

3- Can the Script and the program share variables and functions from
within the EXE.

4- I know this is hard to answer based on the small amount of
information I have provided, but how does TCL rate as the script enging
for my program, compared with others, Perl, Python, et al?

Thanks. I would appreciate any extra insight or knowledge that you can
throw my way.

Harold Howe



Mon, 01 Nov 1999 03:00:00 GMT  
 How to call a Windows API function from a TCL script



Quote:
>Howdy folks,

>I am researching ways to add scripting support to a PC hardware testing
>program that runs on Windows 95 and Windows NT. I really don't know
>squatt about TCL and I have several questions:

>1- Can an API function be called from within the script, like
>GetSystemMetrics?

Yes! You would have to create a tcl command to convert arguements
and/or results to/from C variables. Check out TclCreateCommand man
page. In the case of GetSystemMetrics, i'd return an array with the
struct element names as the keys and the values as strings. This can
be done from within a c function.

Quote:
>2- Could the script call a DLL function?

Yup! Check out package require and load library. The function called
in the dll must be set up as a tcl command - check out the dll example
available on the Sunscript site.

Quote:
>3- Can the Script and the program share variables and functions from
>within the EXE.

You can explicitly share variables via some sort of accessor commands,
but you can't just declare a var in tcl that is immediately visible to
a C program or vice versa.

Quote:
>4- I know this is hard to answer based on the small amount of
>information I have provided, but how does TCL rate as the script enging
>for my program, compared with others, Perl, Python, et al?

Well, _personally_, I think tcl is the best - it's more tailored for
being a drop-in scripting language then the others. Pearl is very
Unix-centric.

Quote:
>Thanks. I would appreciate any extra insight or knowledge that you can
>throw my way.

1) RTFM :-)
2) Get the next edition of Welch's book due out soon (June??) and the
new TCL extensions book due at the end of May from O'Reilly
(http://www.ora.com) - likely to be a HOT book!
3) If, like the rest of us Windows people, you can't read man pages,
download the itcl2.2 distribution which has all the tcl and tk man
pages turned into html. Itcl is itself a hoot too :-)
4. Check out SWIG - Simplified Wrapper and Interface Generator to
"auto create" C/C++ linkages for tcl (and pearl/python/grail).
http://www.cs.utah.edu/~beazley/SWIG/
5. SCO has the best directory page for tcl goodies in my opinion at
http://www.sco.com/tcl

Quote:
>Harold Howe


Dave


Tue, 02 Nov 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Calling Windows API functions involving windows?

2. some clear examples for FFI call to a Windows api function in Franz Allegro for Windows

3. conversion from Tcl script to Tcl API calls

4. Calling Win32 API functions with GNAT 3.09 on Windows 95

5. Calling Windows API functions

6. tcl/tk 8.0 problem with Windows app that calls tcl/tk script

7. calling a tcl script form another tcl script

8. Call Perl function in Tcl scripts??

9. Tcl core dumps if Tcl API called before creating interpreter

10. VC++ calling fortran function and fortran function calling a c++ function

11. Api calls Where I can found C function prototypes

12. Calling all WinAPI Gurus: Help me make a list of Useful API functions for CW programmers

 

 
Powered by phpBB® Forum Software