Autor Beitrag
Solid Snake
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44

Win XP Prof, Suse Linux 9 Prof
D7 Enterprise
BeitragVerfasst: Do 13.01.05 21:13 
hi
Ich möchte über meine Programm per Button Programme starten die im Windows bzw. System Ordner liegen!

Da ja die Windows und System Verzeichnisse für XP und 2000 Verschieden sind muss ich irgendwie den Pfad ermitteln!

z.b. für 2000 den Explorer öffnen
ausblenden Delphi-Quelltext
1:
ShellExecute(Application.Handle, 'open', 'C:\WINNT\explorer.exe', nil, nil, SW_SHOW);					

Das geht natürlich nicht unter XP!
da heist es ja C:\Windows\explorer.exe

Ich habe schon einige möglichkeiten ausprobiert wie z.b.
ausblenden Delphi-Quelltext
1:
ShellExecute(Application.Handle, 'open', 'GetWinDir\explorer.exe', nil, nil, SW_SHOW);					

Funktioniert aber net :cry:

Es gibt doch bestimmt einen befehl der mich direkt in den Windows ordner bzw. bei 2000 in den WINNT ordner bringt!
und einen Befehl der mich direkt in den System32 Ordner bringt!

Doch wie gehen diese befehle? :?

_________________
Wenn der Computer mit 0100101001010 Arbeitet ist ok,
aber wenn er mit 110 anfängt mach ich ihn kaputt!
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Do 13.01.05 21:24 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
function Systemverzeichnisse:string;
var astring: Array[0..max_path+1] of Char;     
begin
  GetSystemDirectory(astring, max_path+1); //bzw. halt GetWindowsDirectory
  result := astring;
end;


fürs system32. fürs normale windowsverzeichniss anstatt getsystemdirectory, einfach getwindowsdirectory einsetzten.


Zuletzt bearbeitet von Karlson am Do 13.01.05 21:32, insgesamt 2-mal bearbeitet
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 13.01.05 21:27 
Karlson hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
function Getwindir:string;
var astring: Array[0..max_path+1] of Char;     
begin
  GetSystemDirectory(astring, max_path+1);
  result := astring;
end;


fürs system32.

Dann solltest du die Funktion auch GetSysDir nennen. :roll:
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Do 13.01.05 21:31 
sorry, ich war mit den Gedanken woanders. Das sollte aber so zu verstehen sein. Durch das ändern des aufrufenamens wird wohl eher weniger der functionsablauf verändert. habs editiert.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Fr 14.01.05 10:03 
Solid Snake hat folgendes geschrieben:
Doch wie gehen diese befehle? :?

Das nächste mal bitte vor dem Posten in unsere FAQ schauen: Wie kann ich das Windows- & das Systemverzeichnis ermitteln?
Solid Snake Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44

Win XP Prof, Suse Linux 9 Prof
D7 Enterprise
BeitragVerfasst: Sa 15.01.05 18:39 
@Tino Ich habe die FAQ gelesen!

Doch die haben mir nicht richtig weitergeholfen!

Wie schon erwähnt will ich mit einem Button Klick eine Programm öffnen!

Folgendes habe ich versucht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.Button6Click(Sender: TObject);
function GetWinDir: String;
const
  UNLEN = MAX_PATH;
var
  Size: DWORD;
begin
  Size := UNLEN + 1;
  SetLength (Result, Size);
  if GetWindowsDirectory (PChar (Result), Size) <> 0 then
    SetLength (Result, StrLen (PChar (Result)))
  else
    Result := '';
 end;
begin
ShellExecute(Application.Handle, 'open', 'GetWinDir+\explorer.exe', nil, nil, SW_SHOW);
end;


Aber das funktioniert nicht! Ich habe auch noch einige andere lösungen Probiert aber ich schaffe es irgendwie nicht!
Ich stehe irgendwie föllig auf dem Schlauch!
Wie schaffe ich es den explorer so zu öffnen??

_________________
Wenn der Computer mit 0100101001010 Arbeitet ist ok,
aber wenn er mit 110 anfängt mach ich ihn kaputt!
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Sa 15.01.05 19:06 
ausblenden Delphi-Quelltext
1:
ShellExecute(Application.Handle, 'open', 'GetWinDir\explorer.exe', nil, nil, SW_SHOW);					

versuch mal, GetWinDir+'Explorer.Exe'

am besten noch IncludeTrailingPathDelimiter verwenden und in nen PChar musst du's sowieso umwandeln, wenn das abe rnich tnur ausversehen mit in den String "gerutscht" ist rate ich dringend zu einem Grundlagen Tutorial.

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)


Zuletzt bearbeitet von GSE am Sa 15.01.05 19:07, insgesamt 1-mal bearbeitet
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Sa 15.01.05 19:07 
Solid Snake hat folgendes geschrieben:
Wie schaffe ich es den explorer so zu öffnen?
ausblenden Delphi-Quelltext
1:
ShellExecute(Application.Handle, 'open', 'GetWinDir+\explorer.exe', nil, nil, SW_SHOW);					

ausblenden Delphi-Quelltext
1:
ShellExecute(GetDesktopWindow, 'open', 'explorer.exe', nil, nil, SW_SHOW);					

_________________
Ciao, Sprint.