Delphi Tips 
-----------------------------

0159  D1   D2   D3   D4   D5   D6   D7   3.1   95   98    作成: 1999/02/11 osamu rev 1.1
   B1   B3   B4   B5   B6   B7   NT3   NT4   2K   XP  更新: 1999/02/11 osamu 編集
CreateProcess を使うときは CloseHandle で後始末

CreateProcess で Process_Infomation に返されるプロセス/スレッドハンドルは、明示的に CloseHandle でクローズしないとまずいです。

Win32 Ref. より抜粋

The created process remains in the system until all threads within the process have terminated and all handles to the process and any of its threads have been closed through calls to CloseHandle. The handles for both the process and the main thread must be closed through calls to CloseHandle. If these handles are not needed, it is best to close them immediately after the process is created.

作成されたプロセスは、プロセス内の全てのスレッドが終了し、かつ全てのプロセスとスレッドのハンドルが CloseHandle でクローズされるまでシステム内に残る。プロセスとメインスレッドのハンドルは必ず CloseHandle でクローズしなければならない。もしこれらのハンドルを使わないならばプロセスを作成した直後にクローズするのが最も良い。
参照: [Delphi-ML:30914] <Windows>

[新規作成] [最新の情報に更新]

How To
Lounge
KeyWords


Tips
Delphi
Home
Osamu Takeuchi osamu@big.or.jp