Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Nur auf Buttonklick ausführung möglich? (https://www.delphipraxis.net/109057-nur-auf-buttonklick-ausfuehrung-moeglich.html)

napsterxx 23. Feb 2008 17:28


Nur auf Buttonklick ausführung möglich?
 
Also ich mache einen Download eines flv Videos. Im OnWorkEnd ereignis der Indy HTTP Komponente habe ich folgendes stehen:
Delphi-Quellcode:
  Windows.WinExec(pchar(ExtractFilePath(Application.ExeName) + 'ffmpeg.exe -i "'+ TempDir + 'THYTDL1.tmp" -vn -ar 44100 -ac 2 -ab 192k "' + LV_Transferlist.Items.Item[0].SubItems.Strings[2] +  '" -y'),0);
Das funktioniert aber nicht. Jedoch funktioniert der gleiche Quelltext wenn ich ihn in das OnClick Ereignis eines Buttons schreibe und ich dann auf diesen manuell klicke. Wieso gehts nun nur wenn ich manuell draufdrücke, und wieso gehts nicht das es automatisch danch gemacht wird?

Luckie 23. Feb 2008 17:32

Re: Nur auf Buttonklick ausführung möglich?
 
Welches Betriebssystem? MSDN-Library durchsuchenWinExec ist verhaltet und nur noch aus Kompatibilitätsgründen zu 16-Bit Programmen vorhanden. Ab Windiws Vista dürfte es nicht mehr existieren, da Windows Vista keine 16-Bit Programme mehr unterstützt.

napsterxx 23. Feb 2008 17:34

Re: Nur auf Buttonklick ausführung möglich?
 
Windows XP SP2

Luckie 23. Feb 2008 17:37

Re: Nur auf Buttonklick ausführung möglich?
 
Hast du dir das mal durchgelsen:
Zitat:

Return Value
If the function succeeds, the return value is greater than 31.

If the function fails, the return value is one of the following error values.

Code:
Return code/value Description

0 The system is out of memory or resources.
ERROR_BAD_FORMAT The .exe file is invalid.
ERROR_FILE_NOT_FOUND The specified file was not found.
ERROR_PATH_NOT_FOUND The specified path was not found.

Und das:
Zitat:

Security Remarks
The executable name is treated as the first white space-delimited string in lpCmdLine. If the executable or path name has a space in it, there is a risk that a different executable could be run because of the way the function parses spaces. The following example is dangerous because the function will attempt to run "Program.exe", if it exists, instead of "MyApp.exe".

napsterxx 23. Feb 2008 17:52

Re: Nur auf Buttonklick ausführung möglich?
 
Jetzt gehts aber wenn ich z.B: Shellexecute nehme dann gehts nicht oO
Aber wenn dsa Programm dann unter Vista nicht geht ist ja auch blöd

Luckie 23. Feb 2008 18:11

Re: Nur auf Buttonklick ausführung möglich?
 
Das geht auch mit Shellexecute. Alternativ kannst du dir auch mal MSDN-Library durchsuchenCreateProcess angucken.

Die Muhkuh 23. Feb 2008 19:14

Re: Nur auf Buttonklick ausführung möglich?
 
Wie rufst Du ShellExecute auf?

alias5000 23. Feb 2008 21:34

Re: Nur auf Buttonklick ausführung möglich?
 
Ja Moment, bist du dir sicher, dass OnWorkEnd überhaupt aufgerufen wird?

Gruß
alias5000

sakura 23. Feb 2008 21:51

Re: Nur auf Buttonklick ausführung möglich?
 
Zitat:

Zitat von Luckie
Ab Windiws Vista dürfte es nicht mehr existieren, da Windows Vista keine 16-Bit Programme mehr unterstützt.

Falschaussage ;) Nur Vista 64-Bit, wie auch XP 64-Bit hat kein 16-Bit Subsystem ;)

...:cat:...


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:55 Uhr.

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