Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 22:40

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Delphi] Aktives Fenster/Programm ermitteln

Discussion on [Delphi] Aktives Fenster/Programm ermitteln within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1

 
マルコ's Avatar
 
elite*gold: 1329
Join Date: Jun 2009
Posts: 1,873
Received Thanks: 960
[Delphi] Aktives Fenster/Programm ermitteln

Hi ihrs,
ich weiß, nur wenige benutzen diese Sprache (auch wenn ich sie super finde^^). Aber vllt kennt sich dennoch wer damit n bisl aus.

Mein Problem:
Ich programier grad einen Passwort Manager. Der 1. Teil (Also der Anmeldeteil für den Manager und der Kryptographoie-Teil für die Passwörter) ist fertig. Nun soll der Manager aber auch noch das richtige Passwort in ein Programm einfügen. Der Benutzer muss zuerst den Exe-Namen des Programms mit seinen Login-Daten eingeben. Damit kann ich überprüfen, welches Programm der eingegebenen Programme gerade läuft. Nun brauch ich aber insofern hilfe, da ich keine Ahnung hab, wie das Programm ermitteln kann, ob das jeweilige Programm auch aktiv ist (so dass es die Daten eingeben kann). Außerdem kann man ja auch mehrere Programme starten, die in der Tabelle aufgeführt sind. Das Programm muss also den richtigen Eintrag raussuchen. Nur WIE mach ich das...(Ich hab schon bei Google gesucht, aber nichts gefunden, das passen würde)
Das ist eigentlich sogar das letzte Puzzleteil, das noch fehlt. Das Programm schreibt per globalem Hotkey die eingegebenen Daten in das aktive Programm.

So, damit ihr euch auchnoch n bild machn könnt, wie das aussieht:


マルコ is offline  
Old 08/05/2010, 19:40   #2
 
HardCore.1337's Avatar
 
elite*gold: 1
Join Date: Feb 2009
Posts: 1,726
Received Thanks: 729
Code:
function CheckProgIsRunnig (AppName : String) : Boolean;
var
  i : Integer;
  pidNeeded : DWORD;
  PIDList : array[0..1000] of Integer; 
  PIDName : array [0..MAX_PATH - 1] of char;
  PH : THandle;
  re : Boolean;
  AppCnt : Byte;
begin
AppCnt := 0;
re := False;

if not Psapi.EnumProcesses(@PIDList, 1000, pidNeeded) then
exit;

for i := 0 to (pidNeeded div sizeof (Integer)- 1) do
begin<BR>
PH := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ,
False, PIDList[i]);
if PH <> 0 then
begin
if Psapi.GetModuleBaseName(PH, 0, PIDName, sizeof (PIDName)) > 0 then
begin
if UpperCase(StrPas(PIDName)) = AppName then Inc(AppCnt);
// ListBox1.Items.Add('process : ' + PIDName);
CloseHandle(PH);
end;
end;
end;
if AppCnt > 1 then Re := True;
Result := re;
end;

...

Procedure TForm1.Button1Click(Sender ....);
  if CheckProgIsRunnig ('PROJECT1.EXE') = True then begin 
end;<BR>
end;<BR>
Quelle:
HardCore.1337 is offline  
Thanks
1 User
Old 08/05/2010, 20:06   #3

 
マルコ's Avatar
 
elite*gold: 1329
Join Date: Jun 2009
Posts: 1,873
Received Thanks: 960
dankääää^^
Jezz kann ich das Teil endlich fertig stellen!

Edit: Nee, geht auch nich. Zumindest nicht mit dem Exe Namen. Ich hab sogar die von Andreas (in dem Entwicklerforum) vorgeschlagene Veränderung vorgenommen. Aber er erkennt nicht, dass Notepad.exe aktiv ist. Schade eigentlich...
マルコ is offline  
Old 08/05/2010, 21:02   #4
 
Krez's Avatar
 
elite*gold: 2437
Join Date: May 2009
Posts: 77
Received Thanks: 276
Krez is offline  
Thanks
1 User
Old 08/07/2010, 12:15   #5

 
マルコ's Avatar
 
elite*gold: 1329
Join Date: Jun 2009
Posts: 1,873
Received Thanks: 960
Quote:
Originally Posted by minecrawler
MarGet, I think you are English , so I answer in English oO

1st : This Unit is buggy. But when I used the Version from the comments (that still had bugs -.-) and corrected it (inserted <>, so no problem at all^^), it worked. It indeed said that notepad was running. But it also said that it's running even though it's not active. Right at the moment, Mozilla Firefox is active. If I press the hotkeys, it sais notepad is running. What I need is a function that tells me, if a program (for example notepad.exe , but can be anything else) is activ at the moment. Maybe you used Google translator and didn't get the problem.
This is a password manager. It should insert the right password for an application when you press a hotkey. But the program has to find out which program is active, so into what program it enters the username and the password. This way, you can open a lot of programs which you entered into the list and the program only inserts the data for the right application.
btw, the following function is much easier for finding out, if a program is running:
Code:
function IsExeRunning(const AExeName: string): boolean;
var
  h: THandle;
  p: TProcessEntry32;
begin
  Result := False;

  p.dwSize := SizeOf(p);
  h := CreateToolHelp32Snapshot(TH32CS_SnapProcess, 0);
  try
    Process32First(h, p);
    repeat
      Result := AnsiUpperCase(AExeName) = AnsiUpperCase(p.szExeFile);
    until Result or (not Process32Next(h, p));
  finally
    CloseHandle(h);
  end;
end;
Leute, das Problem ist noch nicht gelöst...mit der Funktion kann man zwar sagen, dass ein Programm läuft, aber nicht, ob es aktiv ist, oder nicht! Hier muss es doch irgendwen gebn, der weiß, wie das geht (von mir aus auch ne Funktion in C/C++ !)
マルコ is offline  
Reply


Similar Threads Similar Threads
DELPHI - Who make Exploits, Hacks and Tools with DELPHI?
05/15/2013 - CO2 Programming - 13 Replies
Hi all. Iwith DELPHI, but a dont now. hello, I use Delphi to program and i like someone put here source code of make Exploits, Hacks and Tools bot here, or part of the code. ty to all
[How To] Programm fenster Schneller wechsel
08/04/2010 - Tutorials - 4 Replies
Hayho, ich bin's mal wieder =) Heute zeige ich wie ihr eurem PC ganz coole Tricks verleihen könnt und ihr ganz lässig eure Windows Fenster wechseln könnt. Das Programm arbeitet im Hintergrund und verbraucht sehr wenig Ressourcen. Das Aussehen: Miniatur all: http://img3.imagebanana.com/img/9vj3lnz1/thumb/5.j pg
Suche makro programm (mehrere fenster, unterschiedliche makros)
05/12/2010 - General Coding - 1 Replies
Hey Leute Ich suche ein Makro Programm, was mehrere Fesnter bedienen kann, und das mit verschiedenen makros. Z.b ich habe 4x word auf und ich möchte das auf jeden dieser 4 fenster ein anderen makro läuft, und ich des weiteren immernoch arbeiten kann, wärend der makros. Die schwierigkeit, die fenster haben die gleichen namen^^
[DELPHI&METIN]Wie sind die Delphi Befehle für einen Bot?
03/07/2010 - General Coding - 3 Replies
Hallo liebe com, ich habe mal eine Frage: Ich möchte einen Metin Bot in Delphi schreiben aber ich weiß nicht die Befehle für eine bestimmte Taste senden etc. könnt ihr mir die pls sagen oder per pn geben MfGGGGGG



All times are GMT +1. The time now is 22:40.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.