Microsoft UI Automation in VisualWorks?
Mark Plas <[email protected]> Wed, 19 Nov 2025 11:23:33 +0000
| Newsgroups | gmane.comp.lang.smalltalk.vwnc |
|---|---|
| Message-ID | <AM8PR05MB79547AF638FD711EB9EFD547FAD7A@AM8PR05MB7954.eurprd05.prod.outlook.com> |
--_000_AM8PR05MB79547AF638FD711EB9EFD547FAD7AAM8PR05MB7954eurp_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi all,
Has anyone ever implemented Microsoft UI Automation in VisualWorks?
https://urldefense.com/v3/__https://learn.microsoft.com/en-us/windows/win32=
/winauto/entry-uiauto-win32__;!!DZ3fjg!_aQGOK7EA64lDd39rsL3YgMyNrjpz-h71lMB=
NG-HmSuaCpXFN4HqRsEhPwgCPsx8cr6dxMreJnNEF_VebzM95XCf$=20
This is becoming a requirement for us, and I wanted to know if anyone has e=
ver done this before.
Alternatively, does anyone know how to intercept a windows message and retu=
rn a result for it from within VisualWorks?
As a small experiment, I tried to intercept the WM_GETOBJECT message as des=
cribed here:
https://urldefense.com/v3/__https://learn.microsoft.com/en-=
us/windows/win32/winauto/wm-getobject__;!!DZ3fjg!_aQGOK7EA64lDd39rsL3YgMyNr=
jpz-h71lMBNG-HmSuaCpXFN4HqRsEhPwgCPsx8cr6dxMreJnNEF_Veb6sI9g7W$=20
In order to do this from within Smalltalk, I tried to replace the window pr=
ocedure of a window, with a callback like this:
| callback old |
old :=3D self getWindowLong: aWindow windowHandle nIndex: -=
4.
callback :=3D CCallback
do: [:hwnd =
:uMsg :wParam :lParam | self CallWindowProcWWith: old with: hwnd with: uMsg=
with: wParam with: lParam]
ofType: sel=
f WNDPROC pointerType.
self setWindowLongPtr: aWindow windowHandle nIndex: -4 dwNe=
wLong: callback.
self halt
In the callback I just call the old window procedure, so the window should =
just behave as if nothing was changed.
However, this doesn't really work. As long as I only move the mouse over a =
window it seems to work, but as soon as I click on a window VisualWorks sto=
ps handling messages and the application needs to be killed.
Does anyone know how to do this?
In summary:
* Has anyone implemented Microsoft UI Automation in VisualWorks?
* Does anyone know how to intercept windows messages and return a resul=
t for them from within VisualWorks Smalltalk code?
Thanks in advance,
Mark
--_000_AM8PR05MB79547AF638FD711EB9EFD547FAD7AAM8PR05MB7954eurp_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" xmlns:w=3D"urn:sc=
hemas-microsoft-com:office:word" xmlns:m=3D"http://schemas.microsoft.com/of=
fice/2004/12/omml" xmlns=3D"http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii">
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:12.0pt;
font-family:"Aptos",sans-serif;
mso-ligatures:standardcontextual;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#467886;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
font-size:12.0pt;
font-family:"Aptos",sans-serif;
mso-ligatures:standardcontextual;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1367607372;
mso-list-type:hybrid;
mso-list-template-ids:-172470470 301370246 67698691 67698693 67698689 6769=
8691 67698693 67698689 67698691 67698693;}
@list l0:level1
{mso-level-start-at:2850;
mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Aptos",sans-serif;
mso-fareast-font-family:Aptos;
mso-bidi-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style>
</head>
<body lang=3D"EN-US" link=3D"#467886" vlink=3D"#96607D" style=3D"word-wrap:=
break-word">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">Hi all,<o:p></o:p><=
/span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">Has anyone ever imp=
lemented <b>
Microsoft</b> UI Automation in VisualWorks?<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></=
span></p>
<p class=3D"MsoNormal" style=3D"text-indent:36.0pt"><span style=3D"font-siz=
e:11.0pt"><a href=3D"https://urldefense.com/v3/__https://learn.microsoft.co=
m/en-us/windows/win32/winauto/entry-uiauto-win32__;!!DZ3fjg!_aQGOK7EA64lDd3=
9rsL3YgMyNrjpz-h71lMBNG-HmSuaCpXFN4HqRsEhPwgCPsx8cr6dxMreJnNEF_VebzM95XCf$"=
>https://learn.microsoft.com/en-us/windows/win32/winauto/entry-uiauto-win32=
</a><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">This is becoming a =
requirement for us, and I wanted to know if anyone has ever done this befor=
e.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">Alternatively, does=
anyone know how to intercept a windows message and return a result for it =
from within VisualWorks?<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">As a small experime=
nt, I tried to intercept the WM_GETOBJECT message as described here:<o:p></=
o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"> &=
nbsp; <a =
href=3D"https://urldefense.com/v3/__https://learn.microsoft.com/en-us/windo=
ws/win32/winauto/wm-getobject__;!!DZ3fjg!_aQGOK7EA64lDd39rsL3YgMyNrjpz-h71l=
MBNG-HmSuaCpXFN4HqRsEhPwgCPsx8cr6dxMreJnNEF_Veb6sI9g7W$">
https://learn.microsoft.com/en-us/windows/win32/winauto/wm-getobject</a><o:=
p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">In order to do this=
from within Smalltalk, I tried to replace the window procedure of a window=
, with a callback like this:<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"> &=
nbsp; | c=
allback old |<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"> &=
nbsp; old=
:=3D self getWindowLong: aWindow windowHandle nIndex: -4.<o:p></o:p></span=
></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"> &=
nbsp; cal=
lback :=3D CCallback<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"> &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; do: [:hwnd :uMs=
g :wParam :lParam | self CallWindowProcWWith: old with: hwnd with: uMsg wit=
h: wParam with: lParam]<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"> &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; ofType: self WN=
DPROC pointerType.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"> &=
nbsp; sel=
f setWindowLongPtr: aWindow windowHandle nIndex: -4 dwNewLong: callback.<o:=
p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"> &=
nbsp; sel=
f halt<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">In the callback I j=
ust call the old window procedure, so the window should just behave as if n=
othing was changed.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">However, this doesn=
’t really work. As long as I only move the mouse over a window it see=
ms to work, but as soon as I click on a window VisualWorks stops handling m=
essages and the application needs to be killed.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">Does anyone know ho=
w to do this?<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">In summary:<o:p></o=
:p></span></p>
<ul style=3D"margin-top:0cm" type=3D"disc">
<li class=3D"MsoListParagraph" style=3D"margin-left:0cm;mso-list:l0 level1 =
lfo1"><span style=3D"font-size:11.0pt">Has anyone implemented Microsoft UI =
Automation in VisualWorks?<o:p></o:p></span></li><li class=3D"MsoListParagr=
aph" style=3D"margin-left:0cm;mso-list:l0 level1 lfo1"><span style=3D"font-=
size:11.0pt">Does anyone know how to intercept windows messages and return =
a result for them from within VisualWorks Smalltalk code?<o:p></o:p></span>=
</li></ul>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">Thanks in advance,<=
o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">Mark<o:p></o:p></sp=
an></p>
</div>
</body>
</html>
--_000_AM8PR05MB79547AF638FD711EB9EFD547FAD7AAM8PR05MB7954eurp_--