Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi ShellExecute-Problem (https://www.delphipraxis.net/13563-shellexecute-problem.html)

silentAMD 21. Dez 2003 12:15


ShellExecute-Problem
 
hallo leute,
ich habe 2 probleme mit meinem dateimanager:

1. wenn ich eine datei, die kein programm zugeordnet hat (z.b. PDF-datei ohne acrobat reader) mit SHELLEXECUTE öffnen will, kommt nichts.
wie kann man bei so einem fall das ÖFFNEN MIT..-fenster anzeigen?

2. ich habe zuletzt den "powerpoint viewer 2003" installiert und wollte von meinem dateimanager aus eine PPS-datei (powerpoint datei) öffnen, aber der viewer öffnet sich nicht. beim windows-explorer (oder auch bei winrar etc) wird der powerpoint viewer mit der datei gestartet.
wie kann ich diese pps-dateien mit meinem dateimanager öffnen? reicht SHELLEXECUTE?


PLEASE HELP :gruebel:

Mirilin 21. Dez 2003 12:41

Re: ShellExecute-Problem
 
:hi:

Library

mfg Tobias

c113plpbr 21. Dez 2003 12:50

Re: ShellExecute-Problem
 
Hi silentAMD (meiner is laut; scheiss lüfter)

Also, die 2. Frage zuerst:
Im Normalfall müsste ShellExecute reichen, aber nur dann wenn dieser Viewer mit der Endung .pps 'verlinkt' ist. Sollte er damit verlinkt sein, und er startet trotzdem nicht kannst du in der Registrierung den Pfad dieses Viewers nachlesen und ihn dann mit hilfe von shellexecute ausführen und als parameter den pfad der auszuführenden datei.

nun die 1. frage:
Sollte die endung in registrierung im rootkey HKEY_CLASSES_ROOT nicht vorhanden sein (also kein schlüssel namens .pps), dann weist du dass nichts starten wird. In diesem Falle kannst (musst) du ein eigenes 'Öffnen mit' -Fenster zeigen in welchem man das betreffende programm dann auswählen kann ...

ich hoffe das war nicht zu kompliziert und hat geholfen, sonst melde dich nochmal
by c113plpbr

silentAMD 21. Dez 2003 12:51

Re: ShellExecute-Problem
 
nee, das weiß ich schon, ich meine wenn das
Delphi-Quellcode:
ShellExecute(0,'open',PChar(Dateiname),nil,PChar(Ordner),SW_SHOW)
nicht klappt, weil keine passende anwendung installiert ist, um diesen dateityp anzusehen (wie pdf ohne acrobat), dass dann das öffnenmit-fenster geöffnet wird.

silentAMD 21. Dez 2003 12:53

Re: ShellExecute-Problem
 
geht das nur mit der registry? :gruebel:

c113plpbr 21. Dez 2003 12:59

Re: ShellExecute-Problem
 
Mir fällt nichts anderes als die Registry ein, denn da wir das ganze mit den Endungen gespeichert ...
Vielleicht gibts noch nen Befehl der das einfach und schnell macht, aber sowas ist mir nicht bekannt

SirThornberry 21. Dez 2003 12:59

Re: ShellExecute-Problem
 
guck mal im msdn da siehst du was die Rückgabewerte von Shellexecute bedeuten. <32 oder so war glabue erfolg ansonsten was anderes..

c113plpbr 21. Dez 2003 13:16

Re: ShellExecute-Problem
 
für die leute die zu faul sind in der msdn nachzuschauen hier ein kleiner auszug:

Zitat:

Return Values
Returns a value greater than 32 if successful, or an error value that is less than or equal to 32 otherwise. The following table lists the error values. The return value is cast as an HINSTANCE for backward compatibility with 16-bit Microsoft® Windows® applications. It is not a true HINSTANCE, however. The only thing that can be done with the returned HINSTANCE is to cast it to an integer and compare it with the value 32 or one of the error codes below.

0 The operating system is out of memory or resources.
ERROR_FILE_NOT_FOUND The specified file was not found.
ERROR_PATH_NOT_FOUND The specified path was not found.
ERROR_BAD_FORMAT The .exe file is invalid (non-Win32® .exe or error in .exe image).
SE_ERR_ACCESSDENIED The operating system denied access to the specified file.
SE_ERR_ASSOCINCOMPLETE The file name association is incomplete or invalid.
SE_ERR_DDEBUSY The DDE transaction could not be completed because other DDE transactions were being processed.
SE_ERR_DDEFAIL The DDE transaction failed.
SE_ERR_DDETIMEOUT The DDE transaction could not be completed because the request timed out.
SE_ERR_DLLNOTFOUND The specified dynamic-link library was not found.
SE_ERR_FNF The specified file was not found.
SE_ERR_NOASSOC There is no application associated with the given file name extension. This error will also be returned if you attempt to print a file that is not printable.
SE_ERR_OOM There was not enough memory to complete the operation.
SE_ERR_PNF The specified path was not found.
SE_ERR_SHARE A sharing violation occurred.

silentAMD 21. Dez 2003 15:03

Re: ShellExecute-Problem
 
Super!!!! :thuimb:
Ich bedanke mich. :hello:

Nach langem suchen hab ich den passenden eintrag gefunden: :coder:

Delphi-Quellcode:
procedure TForm1.Open(FileName, Directory: String);
begin
ShellExecute(0,'open',PChar(FileName), nil, PChar(Directory), SW_NORMAL);
if getlasterror = ERROR_NO_ASSOCIATION then
ShellExecute(0,'open','rundll32.exe', PChar('shell32.dll,OpenAs_RunDLL '+FileName), PChar(Directory), SW_SHOW)
end;
muss man getlasterror verwenden oder gibt es eine alternative? :dp:

Luckie 21. Dez 2003 16:27

Re: ShellExecute-Problem
 
Delphi-Quellcode:
Error := ShellExecute(...
Oder
Delphi-Quellcode:
if ShellExecute(...) = ERROR_NO_ASSOCIATION then


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:33 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz