Project home page, including documentation, examples and download
links, is at
http://twapi.magicsplat.com
V2.0 Changes
------------
See http://twapi.magicsplat.com/versionhistory.html
for a list of changes
TWAPI Summary
--------------
The Tcl Windows API (TWAPI) extension provides
access to over 460 functions in the Windows API
from within the Tcl scripting language. The
extension targets Windows 2000, Windows XP and Windows
2003). Windows Vista is currently untested.
Functions in the following areas are implemented:
* System functions including OS and CPU information,
shutdown and message formatting
* User and group management
* Security and resource access control
* Window management
* User input: generate key/mouse input and hotkeys
* Basic sound playback functions
* Windows services (implementation and control)
* Windows event log access
* Process and thread management
* Directory change monitoring
* Lan Manager and file and print shares
* Drive information, file system types etc.
* Network configuration and statistics
* Network connection monitoring and control
* Clipboard access
* Console mode functions
* System performance data
* Window stations and desktops
* Internationalization
* Task scheduling
* Shell functions for shortcuts, themes, dialogs
* COM client support
* Windows Installer
* Power management
* Device I/O and notifications
* Crypto API
On Tue, 23 Sep 2008, APN wrote:
> Version 2.0.12 of the Tcl Windows API (TWAPI) extension has been
> released.
I've not checked this version, in 1.1 I could not find a solution.
Q: Is it possible to get the information, if the current running XP OS
version is 32-bit or 64-bit?
--
Gerhard Reithofer
Tech-EDV Support Forum - http://support.tech-edv.co.at
I've installed ActiveTCL 8.5 and tried to continue with teacup.
When running
teacup list --http-proxy $PROXY:$PORT --only uninstalled
I get from the proxy server an error message that I'm not authenticated
correctly.
But how can I authenticate - I've not seen any option for this?
>Hello,
>
>I've installed ActiveTCL 8.5 and tried to continue with teacup.
>
>When running
> teacup list --http-proxy $PROXY:$PORT --only uninstalled
>I get from the proxy server an error message that I'm not authenticated
>correctly.
>
>But how can I authenticate - I've not seen any option for this?
>
try setting two environment variables
set http_proxy_user=NTDOMAIN\username
set http_proxy_pass=yourpassword
then run teacup. You can also set http_proxy=http://proxyhost:port/
but that can be read from the IE settings anyway.
--
Pat Thoyts http://www.patthoyts.tk/
To reply, rot13 the return address or read the X-Address header.
PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
I haven't laid hands on a 64bit machine, but I suppose that these
entries in ::tcl_platform will be 8 on a 64bit machine:
tcl_platform(pointerSize) = 4
tcl_platform(wordSize) = 4
> Gerhard Reithofer <gerhard....@tech-edv.co.at> writes:
>
> >Hello,
> >
> >I've installed ActiveTCL 8.5 and tried to continue with teacup.
...
> >But how can I authenticate - I've not seen any option for this?
> >
>
> try setting two environment variables
> set http_proxy_user=NTDOMAIN\username
> set http_proxy_pass=yourpassword
> then run teacup. You can also set http_proxy=http://proxyhost:port/
> but that can be read from the IE settings anyway.
Thanks, it works (setting the variables). I assume that this can also be
used on Linux/Unix.
IMHO the usage message should be adapted to give this information.
The connection is now ok, but ...
INTERNAL ERROR ______________________
INTERNAL ERROR Instance "application teacup 8.5.5.0.287340 win32-ix86" does not exist
INTERNAL ERROR while executing
INTERNAL ERROR "# Compiled -- no source code available
INTERNAL ERROR error "called a copy of a compiled script""
INTERNAL ERROR (procedure "::repository::api::Snit_methodsync" line 1)
INTERNAL ERROR invoked from within
INTERNAL ERROR "::repository::client::proxy1 sync require {application teacup 8.5.5.0.287340 win32-ix86}"
INTERNAL ERROR ("uplevel" body line 1)
INTERNAL ERROR invoked from within
INTERNAL ERROR "# Compiled -- no source code available
INTERNAL ERROR error "called a copy of a compiled script""
INTERNAL ERROR (procedure "::repository::client::Snit_methodRun" line 1)
INTERNAL ERROR invoked from within
INTERNAL ERROR "# Compiled -- no source code available
INTERNAL ERROR error "called a copy of a compiled script""
INTERNAL ERROR (procedure "::repository::client::Snit_methodRequirements" line 1)
INTERNAL ERROR invoked from within
... etc ...
Any hints?
You do not need TWAPI for this. See
http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx
/Ashok
> On Sep 24, 2:29 am, Gerhard Reithofer <gerhard.reitho...@tech-
> edv.co.at> wrote:
> > Hi TCLers,
> >
> > On Tue, 23 Sep 2008, APN wrote:
> > > Version 2.0.12 of the Tcl Windows API (TWAPI) extension has been
> > > released.
> >
> > I've not checked this version, in 1.1 I could not find a solution.
> >
> > Q: Is it possible to get the information, if the current running XP OS
> > version is 32-bit or 64-bit?
...
> You do not need TWAPI for this. See
> http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx
Interesting page, but it doesn't sound very consistent or secure.
1. It depends on the PROCESSOR_ARCHITECTURE (amd64, i64) and doesn't
seem to be a "documented" and reliable method - see:
> Note: the x64 processor architecture is sometimes referred to as
> "AMD64", "x86-64", "AMD x86-64" or "Intel64".
2. The reason while I posted this in the TWAPI tread ist that XP's
systeminfo command displays the "64" in the operating system
description, but TWAPI 1.1 does not.
Currently I'm using [exec systeminfo] to check this and I hoped that
the new TWAPI could give the same information.
THX
this sounds really good, but I'm afraid that we get the sizes from the
tcl version:
Source at_debian_dists_stable_main_binary-amd64_Packages
% info patchlevel
8.4.12
% parray tcl_platform
tcl_platform(byteOrder) = littleEndian
tcl_platform(machine) = x86_64
tcl_platform(os) = Linux
tcl_platform(osVersion) = 2.6.18-6-amd64
tcl_platform(platform) = unix
tcl_platform(threaded) = 1
tcl_platform(user) = gerhardr
tcl_platform(wordSize) = 8
Source ActiveTcl8.5.3.0.286404-linux-ix86-threaded.tar.gz
% info patchlevel
8.5.3
% parray tcl_platform
tcl_platform(byteOrder) = littleEndian
tcl_platform(machine) = x86_64
tcl_platform(os) = Linux
tcl_platform(osVersion) = 2.6.18-6-amd64
tcl_platform(platform) = unix
tcl_platform(pointerSize) = 4
tcl_platform(threaded) = 1
tcl_platform(user) = gerhardr
tcl_platform(wordSize) = 4
I did not check this on windows but I'm afraid this could be the same,
but I will check this.
Danke Richard
Check out < http://wiki.tcl.tk/tcl_platform >, where members of the
community have been reporting values of this tcl built in array for
various configurations and platforms.
twapi::get_process_info [pid] -all
The specified object was not found on the computer.
The computer that returns this runs windows server 2008, 64 bit.
On the other hand under vista ultimate 64 bit it works just fine.
Any ideas?
George
O/H APN έγραψε:
Unfortunately, I only have XP and Win2K available for testing (which
is why even Vista is unsupported) so cannot tell you exactly what the
error is. I'm actually a little surprised that it runs on Vista 64bit
(even as a 32bit app).
What you might do is try each individual option to get_process_info
(instead of using -all) to see which is failing. I might be able to
suggest a workaround if you can narrow it down to the failing
option(s).
/Ashok
The specified object was not found on the computer.
while executing
"PdhEnumObjectItems $opts(datasource) $opts(machine) $objname
$windefs($detail_index) 0"
(procedure "get_perf_object_items" line 25)
invoked from within
"get_perf_object_items $object -machine $opts(machine) -datasource
$opts(datasource)"
(procedure "get_perf_counter_paths" line 15)
invoked from within
"get_perf_counter_paths [_localize_perf_counter "Process"] [list
[_localize_perf_counter "ID Process"]] $pids -machine $opts(machine)
-datasource $..."
(procedure "get_perf_process_counter_paths" line 65)
invoked from within
"get_perf_process_counter_paths 220588 -privatebytes"
("eval" body line 1)
invoked from within
"eval [list get_perf_process_counter_paths $pids] $wanted_pdh_opts"
(procedure "get_multiple_process_info" line 315)
invoked from within
"get_multiple_process_info 220588 -all"
("eval" body line 1)
invoked from within
"eval [list get_multiple_process_info [list $pid]] $args"
(procedure "::twapi::get_process_info" line 2)
invoked from within
"::twapi::get_process_info [pid] -all"
The failing line is 762 of process.tcl:
set counters [eval [list get_perf_process_counter_paths $pids] \
$wanted_pdh_opts]
The value of $wanted_pdh_opts is -privatebytes.
Is this more helpful?
In my vista 64 machine it works though :-)
George
O/H APN έγραψε:
http://technet.microsoft.com/en-us/sysinternals/bb896682.aspx
In particular, 'pslist -m [pid]' seems to answer your question.
No idea how it behaves on Vista nor Vista64 though.
-Alex
http://msdn.microsoft.com/en-us/library/ms683219(VS.85).aspx
There is an example here:
http://msdn.microsoft.com/en-us/library/ms682050(VS.85).aspx
Can I call it?
George
O/H APN έγραψε:
/Ashok
I am only interested in getting the (total) memory occupied by the
process. Isn't this available in the PagefileUsage field?
This is in the PROCESS_MEMORY_COUNTERS structure (which says Windows
2000 professional) and not in the PROCESS_MEMORY_COUNTERS_EX that
requires XP. Do you think that there is a problem in supporting this in
twapi? (Is windows 2000 professional the same as win2k that you build
twapi?)
I am just wondering, from where does windows task amanger gets the info
about processes memory?
George
O/H APN έγραψε:
If page file bytes is what you want, you can try
twapi::get_process_info [pid] -pagefilebytes
That does not use the performance counters and you should not see the
error you saw before (I think).
However, page file usage might not be what you are looking for. "Total
memory usage" is ambiguous - do you want it to mean virtual address
space allocated? Or number of pages used in the paging file? Or number
of pages used in physical memory? Should it include memory that is
shared with other processes (eg. memory occupied by kernel32.dll) ?
If I recall correctly, page file usage does NOT include physical
memory in use that has not been committed to the page file. In Windows
total available virtual memory is (physical memory + page file),
unlike some systems where every physical memory page also has space
allocated in the page file.
See http://shsc.info/WindowsMemoryManagement for an overview of these
issues.
If all you are looking for is to track down when memory usage spikes,
one of the following might work -
twapi::get_process_info [pid] -virtualbytes
or
add the sum of the -workingset and -pagefilebytes options.
I don't think either of these access the performance data counter
subsystem so should not generate the error you are seeing with the
missing object message.
/Ashok
/Ashok
Dear Ashok,
Yes, I am targeting what task manager shows, and -workingset worked just
fine!
I really thank you for pointing this out. Please consider adding an
example of this in the documentation, as I think that getting this info
is quite importan for many applications :-)
George
Dear All
Recently I get Tcl Windows API extension 2.0.12 and try some example
to MS EXCEL ( from http://twapi.magicsplat.com/). It didn't work --->
why ???
code:
package require twapi
set xl [twapi::comobj Excel.Application]
$xl Visible true
set workbooks [$xl Workbooks]
set workbook [$workbooks Add]
set sheets [$workbook Sheets]
set sheet [$sheets Item 1]
set cells [$sheet range a1 c3]
$cells Value 12345
$cells -destroy
$sheet -destroy
$sheets -destroy
$workbook -destroy
$workbooks -destroy
$xl Quit
$xl -destroy
error message:
occur exception condition。
while executing
"twapi::IDispatch_Invoke _5cb81700_p_IDispatch {6 {} 0 2 12 {{12 17}}}
12345"
("uplevel" body line 1)
invoked from within
"DbgNub_uplevelCmd DbgNub_uplevelCmd $args"
invoked from within
"uplevel 1 [list twapi::IDispatch_Invoke $ifc $prototype] $args"
(procedure "twapi::idispatch_invoke" line 7)
invoked from within
"twapi::idispatch_invoke _5cb81700_p_IDispatch {6 {} 0 2 12 {{12 17}}}
12345"
("eval" body line 1)
invoked from within
"eval [list twapi::idispatch_invoke $ifc
$::twapi::idispatch_prototypes($ifc,$name,0,$flags)] $params"
(procedure "::twapi::_comobj_wrapper" line 342)
invoked from within
"$cells Value 12345"
Could some one give me some direction to solve this error?
My platform: windows XP3
Tcl rev. 8.4.18.0
BR
Rolance