Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

perform an action when window has changed.

Posted on 2004-10-06
2
Medium Priority
?
217 Views
Last Modified: 2010-04-05
Hi!!


I am making a console application.
I want to perform an action when window has changed.
I've created timer.

This is a function for getting window caption maybe it can help you answerring my question.

GetWindowText(GetForegroundWindow , @buf[0], SizeOf(buf) - 1);
 writeln(buf);



Thank you
0
Comment
Question by:ssivagna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Expert Comment

by:calinutz
ID: 12241929
window has changed?
0
 
LVL 4

Accepted Solution

by:
Evarest earned 500 total points
ID: 12242218
Try this code:

program Project1;

uses
  SysUtils, Windows, Forms;

{$apptype console}

var
 OldCaption: string;
 WNDCaption: array[0..255] of char;
begin
  while true do
   begin
    GetWindowText(GetForeGroundWindow, @WNDCaption[0], sizeof(WNDCaption)-1);
    if OldCaption <> WNDCaption
     then WriteLn('New Window: '+WndCaption);
    OldCaption :=WNDCaption;
    sleep(10);
   end;
end.

This small program will continuously loop and add any new window to the console output (if the caption is different).

Regards,
Evarest
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question