` Printed Icetips Article

Icetips Article



Par2: Shutting down a running EXE from another EXE -- Window Title known
1998-08-04 -- Jim Kane
 
The steps involved are to 1st get the hwnd or windows handle for the frame
or main window of the app to be shut down, then post a wm_close message to
that hwnd.

Step 1 is simple if the text on the title line of the app is always the
same - just use the findwindow() api:
wm_Close equate(10H)
titlestr cstring(80)
hwnd unsigned
Titlestr = 'Calculator'  !or what ever it is
hwnd=findwindow(titlestr,)

Then once you want a hwnd:
PostMessage(hwnd,wm_close,0,0)

You can get the prototypes for the api calls from the winapi program with
cw



Printed April 29, 2024, 10:52 am
This article has been viewed/printed 35111 times.