The following works for me in a shell
% package require twapi
4.2.12
% exec notepad &
1680
% set w [lindex [twapi::find_windows -toplevel 1 -text Untitled* -match
glob] 0]
984802 HWND
% twapi::resize_window $w 400 200
Note that for this to work, the window has to be resizable in the first
place. I doubt that the desktop window can be resized this way. Not even
sure what the semantics would be.
Regarding invalid pointer error, pointers/handles are typed in twapi and
consist of a pair containing the pointer value and its type. Thus above
the window handle is {984802 HWND}, not just the 984802.
/Ashok