🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #16673

Click a button on another application

#16673
From: Dubhglas
Date: Mon, 05 May 2003 09:49
35 lines
2176 bytes
Hello everybody,

Someone bought a software which detects phone calls (used to charge the
appropriate share of costs among several companies in the same building).
Now, I'd like to shut down that PC after, say, a couple of hours after
closing time (just in case someone stays a little later).

Problem is, I don't have access to the programmer who made it, and the
buttons have <no> shortcut (grr...)

I have been able to bring the program into focus, move the mouse over the
button(s) (after checking the resolution being used) and use a mouse_event
etc.
Something like this (details omitted):

HWND Otherwindow;
Otherwindow=FindWindow("Telephone", NULL);
SetForegroundWindow(Otherwindow);
SetFocus();
----

mouse_event(MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_MOVE, (65535/1240*100),
(65535/1024*200), 0, 0);
mouse_event(MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_LEFTDOWN, (65535/1240*100),
(65535/1024*200), 0, 0);
mouse_event(MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_LEFTUP, (65535/1240*100),
(65535/1024*200), 0, 0);


However, that's far from an "elegant" solution. Isn't there a way to
"address" a button (not a window) in another application? If there is, and
if I don't ask too much, does anyone also know the syntax to use?

TIA
Technical Details
Message-ID: <3eb633b0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,d9604e51f8dfe8bf,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-05-05 02:52:22 PST
From: "Dubhglas" <info_remove@pixel-gc.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Click a button on another application
Date: Mon, 5 May 2003 11:49:35 +0200
Lines: 39
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 80.105.70.126
Message-ID: <3eb633b0$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1052128176 80.105.70.126 (5 May 2003 02:49:36 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail