Autor Beitrag
dac424
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: Fr 28.09.12 17:57 
hallo Liebe Progger ich habe ein Kleines Menue Erstellt doch das Schellexcute übernimmt mein Userdata Pfad nicht

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button3Click(Sender: TObject);
begin;
   ShellExecute(Handle,'open','%USERPROFILE%\AppData\Local\ClubCooee\Program\cooee.exe',nil,nil,SW_ShowNormal);
end;


normaler weise sollte er c:\Users\Kunde einsetzen

da das Menue auch auf Windows XP und Windows / laufen Sollte

ich bitte daher um Hilfe.

Moderiert von user profile iconMartok: Delphi-Tags hinzugefügt
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 28.09.12 18:06 
Das wird an der Stelle nicht ersetzt, den Pfad musst du schon selbst vorher erfragen und einfügen:
www.entwickler-ecke....ner+finden_9428.html
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Fr 28.09.12 18:08 
Du kannst diese Funktion verwenden:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
function GetSpecialDirectory(CSIDL: Integer; Handle: Cardinal = 0): String;
const
  SHGFP_TYPE_CURRENT = 0;
var
  APIResult: HRESULT;
  Buffer: Array[0 .. MAX_PATH - 1of WCHAR;
begin
  Result := '';

  APIResult := SHGetFolderPathW(Handle, CSIDL, 0, SHGFP_TYPE_CURRENT, Buffer);

  if APIResult = S_OK then
    Result := SysUtils.IncludeTrailingPathDelimiter(WideString(Buffer));
end;


Aufruf:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var
  path: String;
begin
  path := GetSpecialDirectory(CSIDL_APPDATA);
end;
dac424 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: Fr 28.09.12 18:34 
da bekomme ich leider immer ne fehlermeldung

SHGetFolderPathW

[Fehler] uMain.pas(72): Undefinierter Bezeichner: 'SHGetFolderPathW'
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Fr 28.09.12 18:37 
user profile icondac424 hat folgendes geschrieben Zum zitierten Posting springen:
da bekomme ich leider immer ne fehlermeldung

SHGetFolderPathW

[Fehler] uMain.pas(72): Undefinierter Bezeichner: 'SHGetFolderPathW'


ausblenden Delphi-Quelltext
1:
2:
uses
  Windows, ........, ShlObj;
dac424 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: Fr 28.09.12 19:44 
Es kommt immer noch der Fehler wäre schön wenn du dir das mal anschauen Köntest kann dir das per PM zukommen lassen.
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Fr 28.09.12 19:55 
wenn Du eine ältere Delphiverion hast und "ShlObj" bereits in den "uses" aufgeführt ist, nimm statt

SHGetFolderPathW mal SHGetFolderPath

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10181
Erhaltene Danke: 1254

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 28.09.12 23:36 
Moin!

user profile icondac424 hat folgendes geschrieben Zum zitierten Posting springen:
das Schellexcute übernimmt mein Userdata Pfad nicht
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button3Click(Sender: TObject);
begin;
   ShellExecute(Handle,'open','cmd /c start %USERPROFILE%\AppData\Local\ClubCooee\Program\cooee.exe',nil,nil,SW_ShowNormal);
end;

normaler weise sollte er c:\Users\Kunde einsetzen
Setz das markierte davor, dann klappt das auch ohne den Pfad mit Delphi selbst ermitteln zu müssen. :idea:

Ob das sinnvoll ist, sei mal dahingestellt. :nixweiss: Zumindest ist es schneller umgesetzt... :zwinker:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
dac424 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: So 21.10.12 00:22 
Lieber Administrator

Schade habe das so übernommen aber es funktioniert nicht.

ich würde dir sehr gerne mal meine Source zukommen lassen den ich lerne anhand sehen einfacher

oder wens dir lieber wäre auch sehr gerne per Teamview
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10181
Erhaltene Danke: 1254

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 21.10.12 01:11 
Moin!

user profile icondac424 hat folgendes geschrieben Zum zitierten Posting springen:
es funktioniert nicht.
Hm, hast leider recht, hab nicht auf die Parameter geschaut... :roll:

So geht´s (vorausgesetzt du kopierst dir die Calc.exe auch nochmal in´s Profil-Verzeichnis zum Testen):
ausblenden Delphi-Quelltext
1:
ShellExecute(0NIL'cmd'' /c start "" "%USERPROFILE%\calc.exe"'NIL, SW_HIDE);					

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
dac424 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: So 21.10.12 01:30 
HM dan mache ich wohl was falsch

es funktioniert nicht ich habe windows 7 ultimate

es geht einfach nicht
ausblenden Delphi-Quelltext
1:
2:
3:
4:
begin;
   ShellExecute(Handle,'open','cmd /c start "" "%USERPROFILE%\AppData\Local\ClubCooee\Program\cooee.exe"',nil,nil,SW_ShowNormal);
   //ShellExecute(0, NIL, 'cmd', ' /c start "" "%USERPROFILE%\calc.exe"', NIL, SW_HIDE)
   end;

ich habe nunmehr beides versucht

SHGetFolderPath und eine menge gelesen dieser Befehl soll es im Windows 7 nicht geben

kann mir den keiner Helfen sende auch sehr gerne meine Source demAdmin zu ist bereits gepackt.

Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10181
Erhaltene Danke: 1254

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 21.10.12 16:49 
Moin!

user profile icondac424 hat folgendes geschrieben Zum zitierten Posting springen:
HM dan mache ich wohl was falsch
Ja, vergleiche mal die markierten Teile: :lupe:
user profile icondac424 hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
begin;
   ShellExecute(Handle,'open','cmd /c start "" "%USERPROFILE%\AppData\Local\ClubCooee\Program\cooee.exe"',nil,nil,SW_ShowNormal);
   //ShellExecute(0, NIL, 'cmd', ' /c start "" "%USERPROFILE%\calc.exe"', NIL, SW_HIDE)
   end;

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.