Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-03

Detecting the start of a service and simulate a click in the yes button of its window

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Arí Ricardo Ody

I would like to know if it's possible to make a program to detect if a service has started in windows. If affirmative this service shows a window and I must to simulate a click on the ?yes? button of this same window, e.g, the program will think that someone click yes in the windows it shows when it starts.

Is it possible to do a program with Lazarus or FPC that solves this problem? If affirmative may someone send me an example of how to do this?

Greetings from Sao paulo - Brazil
Ricardo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100306/776a9618/attachment.html>

Reply by email

Zaher Dirkey
to Arí Ricardo Ody

2010/3/6 "Ar? Ricardo Ody"

Show quoted text 15 lines
I would like to know if it's possible to make a program to detect if a service has started in windows. If affirmative this service shows a window and I must to simulate a click on the ?yes? button of this same window, e.g, the program will think that someone click yes in the windows it shows when it starts. Is it possible to do a program with Lazarus or FPC that solves this problem? If affirmative may someone send me an example of how to do this?

In short You can make FindWindow then Send a key (y/Return) to this window.

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100306/57ffde3c/attachment.html>

Reply by email

Michael Van Canneyt
to Arí Ricardo Ody: I would like to know if it's possible to make a program to detect if a service has…
"Ar? Ricardo Ody" wrote 10 lines
? I would like to know if it's possible to make a program to detect if a service has started in windows. If affirmative this service shows a window and I must to simulate a click on the ?yes? button of this same window, e.g, the program will think that someone click yes in the windows it shows when it starts. Is it possible to do a program with Lazarus or FPC that solves this problem? If affirmative may someone send me an example of how to do this?

You can use the TServiceManager component to detect whether a service runs. I have coded this component, it is in active use in commercial projects.

But there is a strange thing about your story: as of Windows Vista, service applications can no longer display a window on the desktop, Windows no longer allows that. So probably, the window is displayed by some other program that comes with the service ?

You can send a keypress to this program's window with the FindWindow call to get the handle and then use a PostMessage() call to send a click or keypress.

Michael.

Reply by email

Arí Ricardo Ody

Although I have no idea about where to use "FindWindow" and "Send a key" I suppose they solve my problem. May you develop, please?

Thanks in advance

Ricardo

Earlier message 20 lines
----- Original Message ----- From: Zaher Dirkey Sent: 03/06/10 05:55 AM To: Lazarus mailing list Subject: Re: [Lazarus] Detecting the start of a service and simulate a click in the yes button of its window 2010/3/6 "Ar? Ricardo Ody" I would like to know if it's possible to make a program to detect if a service has started in windows. If affirmative this service shows a window and I must to simulate a click on the ?yes? button of this same window, e.g, the program will think that someone click yes in the windows it shows when it starts. Is it possible to do a program with Lazarus or FPC that solves this problem? If affirmative may someone send me an example of how to do this? In short You can make FindWindow then Send a key (y/Return) to this window. -- Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100306/3e797339/attachment.html>

Reply by email