🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

which app is curently having focus

#3946
From: Tom
Date: Thu, 06 Apr 2006 15:46
21 lines
1571 bytes
I use the following code to determine the processes that are running, 
but how can I find out which application has the focus (in which 
application user is currently working)

  ListBox1->Items->Clear();
  HANDLE snapshot;
  PROCESSENTRY32 processinfo;
  processinfo.dwSize = sizeof(processinfo);
  snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
  if (snapshot == NULL)
   return;
  bool status = Process32First(snapshot, &processinfo);
  while(status)
   {
   ListBox1->Items->Add(processinfo.szExeFile);
   status = Process32Next(snapshot, &processinfo);
   }
  Form1->Caption = IntToStr(ListBox1->Items->Count);

thanks in advance
tom
Technical Details
Message-ID: <443537a4$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!news.glorb.com!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,17a2084ef11c8c02,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Thu, 06 Apr 2006 17:46:18 +0200
From: Tom <tom@net.com>
Reply-To:  tom@net.com
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: which app is curently having focus
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 213.202.115.247
Message-ID: <443537a4$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1144338340 213.202.115.247 (6 Apr 2006 08:45:40 -0700)
Lines: 21
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!news.glorb.com!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail