View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004169 | JEDI VCL | 00 JVCL Components | public | 2007-07-09 19:03 | 2007-10-12 06:54 |
Reporter | FireStormX | Assigned To | obones | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | no change required | ||
Product Version | 3.00 | ||||
Target Version | Fixed in Version | ||||
Summary | 0004169: OnTerminate event does not fire when running from a console application. | ||||
Description | I can't get the OnTerminate event to fire when I use the JvCreateProcess component in a console application. Reproduce: Main console app: begin { TODO -oUser -cConsole Main : Insert code here } DataModule2 := TDataModule2.Create( nil ); try DataModule2.doit; while DataModule2.p.State <> psReady do begin application.ProcessMessages; sleep(1); end; finally DataModule2.free; end; end. In the Datamodule: procedure TDataModule2.doit; begin p.CommandLine := 'notepad.exe c:\temp\1.htm'; p.Run; end; procedure TDataModule2.pTerminate(Sender: TObject; ExitCode: Cardinal); begin ShowMessage( 'terminated' ); //this doesn't ever get executed! end; Please help guys and gals. | ||||
Tags | No tags attached. | ||||
|
using Delphi 7 on WinXP... |
2007-07-09 19:07
|
reproduce.7z (4,857 bytes) |
|
AFAIK, there are no messages for a console application, so the Application.ProcessMessages call should never return. On top of that, IIRC the OnTerminate event is called via "Synchronize" hence you should call "CheckSynchronize" in your loop. Let me know if that helps. |
|
Thank you VERY much for the prompt response! Classes.CheckSynchronize() did the trick! I hear your comment on Application.ProcessMessages, but...if I don't call ProcessMessages and redirect the stdout of the called console app it doesn't show the text when it is written by the application. I've included the source and binaries (one with the call and one without) of a test application that will show you this. If there is some other function to achieve this, please let me know. |
2007-07-10 03:43
|
JvCreateProcessTest_bin.7z (197,453 bytes) |
2007-07-10 03:43
|
JvCreateProcessTest_Src.7z (1,252 bytes) |
|
Ah yes, the process message is needed in that case, you are right. Glad you got this sorted. |
Date Modified | Username | Field | Change |
---|---|---|---|
2007-07-09 19:03 | FireStormX | New Issue | |
2007-07-09 19:05 | FireStormX | Note Added: 0013554 | |
2007-07-09 19:07 | FireStormX | File Added: reproduce.7z | |
2007-07-10 02:13 | obones | Note Added: 0013556 | |
2007-07-10 02:13 | obones | Status | new => feedback |
2007-07-10 03:40 | FireStormX | Note Added: 0013558 | |
2007-07-10 03:43 | FireStormX | File Added: JvCreateProcessTest_bin.7z | |
2007-07-10 03:43 | FireStormX | File Added: JvCreateProcessTest_Src.7z | |
2007-10-12 06:53 | obones | Status | feedback => resolved |
2007-10-12 06:53 | obones | Resolution | open => no change required |
2007-10-12 06:53 | obones | Assigned To | => obones |
2007-10-12 06:53 | obones | Note Added: 0013919 |