Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Sandbox programmieren (https://www.delphipraxis.net/63377-sandbox-programmieren.html)

3_of_8 17. Feb 2006 19:43


Sandbox programmieren
 
Morgen.

Ich glaube das Ding, das ich machen will heißt Sandbox.

Das ist nur zur Übung gedacht.

Ich hab schon das Forum durchsucht, aber nicht gefunden, was ich meinte.

Mein Problem ist momentan folgendes:

Ich will ein Programm starten (ShellExecute) und schnapp mir das, was ShellExecute zurückgibt. (Das Handle, oder?)

Dann will ich, dass das Programm auf meinem Panel angezeigt wird (Panel1), also dass das Programm in Panel1 ist. (Panel1.Handle:=ProcHandle hab ich schon probiert)

Und schließlich will ich das Programm auch noch beenden (TerminateProcess(ProcHandle) macht überhaupt nix.)

Luckie 17. Feb 2006 20:46

Re: Sandbox programmieren
 
Das ist keine Sandbox. Eine Sandbox ist eine komplett abgeschottete Umgebung in der der Prozess keinen Scahdenanrichten kann. Eine VM wäre so was.

Such dir das Hauptfenster mit FindWindow und setze das Parenthandle neu mit Setparent auf das Panel deiner anwendung. Shellexecute liefert kein Handle zurück:
Zitat:

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 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 int and compare it with the value 32 or one of the error codes below.
Ich dachte, das hätte sich langsam mal rumgesprochen, Win3.11 Zeiten sind doch schon etwas länger vorbei. :mrgreen:

3_of_8 17. Feb 2006 21:11

Re: Sandbox programmieren
 
Jetzt wo dus erwähnst, fällt mir wieder ein, das mit dem ShellExecute Fehler schon mal irgendwo gelesen zu haben.

Aber ich habe noch nicht ganz verstanden, wie ich FindWindow einsetze. Woher kriege ich die Werte, die ich für die Parameter brauche? Bitte mal ein Beispiel.

Luckie 17. Feb 2006 21:17

Re: Sandbox programmieren
 
Entweder im Forum mal suchen oder im MSDN gucken: MSDN-Library durchsuchenFindWindow.

3_of_8 17. Feb 2006 21:19

Re: Sandbox programmieren
 
Du hast meine Frage nicht ganz gelesen. Ich weiß, was das für Werte sein sollen, aber woher ich die kriege, ist die Frage.

retnyg 17. Feb 2006 21:39

Re: Sandbox programmieren
 
starte das programm mit Hier im Forum suchenCreateProcess das liefert dir ein handle zurück

3_of_8 17. Feb 2006 21:49

Re: Sandbox programmieren
 
Gibt das nicht einen Boolean?

retnyg 18. Feb 2006 01:17

Re: Sandbox programmieren
 
jo aber in der PROCESS_INFORMATION struct steht die prozessid drin, über die du an das windowhandle kommst:
siehe beitrag von sepp, hier http://www.delphipraxis.net/internal...ndle+prozessid


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:10 Uhr.

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