Autor Beitrag
Xerox
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 45

WinXP Pro, WinMe
D7 Pers
BeitragVerfasst: Mo 18.07.05 11:45 
Hallo!

Ich habe 2 Programme geschrieben, in das 2. Programm will ich eine Routine einbauen, mit der das erste Programm geschlossen wird.



Könntet ihr mir bitte helfen?

MFG
Xerox


Moderiert von user profile iconGausi: Topic aus CLX / Delphi Language (Object-Pascal) verschoben am Mo 18.07.2005 um 12:27
Handycommander
ontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1054

Windows XP Pro, Vista
Visual Studio 2008
BeitragVerfasst: Mo 18.07.05 11:48 
Versuchs mal so.


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
function TForm1.SucheFensterUeberTitel(FensterTitel: string): Hwnd; 
var 
  NextHandle: Hwnd; 
  NextTitle: array[0..260of char; 
begin 
  NextHandle := GetWindow(Application.Handle, GW_HWNDFIRST); 
  while NextHandle > 0 do begin 
    GetWindowText(NextHandle, NextTitle, 255); 
    if Pos(FensterTitel, StrPas(NextTitle)) <> 0 then begin 
      Result := NextHandle; 
      Exit; 
    end else 
      NextHandle := GetWindow(NextHandle, GW_HWNDNEXT); 
  end
  Result := 0
end

procedure TForm1.Button1Click(Sender: TObject); 
begin 
  if SucheFensterUeberTitel('Arbeitsplatz') <> 0 then  
  Showmessage('Arbeitsplatz offen'); 
end;


Damit sollte es gehen
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mo 18.07.05 12:02 
wenn dann schon
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Button1Click(Sender: TObject); 
var h: hwnd;
begin 
  h := SucheFensterUeberTitel('Microsoft Excel');
  if h <> 0 then postmessage(h,WM_CLOSE,0,0); 
end;

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
Xerox Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 45

WinXP Pro, WinMe
D7 Pers
BeitragVerfasst: Mo 18.07.05 12:17 
Funkitoniert wunderbar!

Vielen Dank für eure schnelle Hilfe!

MFG
Xerox