?? 如何在 delphi 應用程序中, 去關閉外部已開啟的應.txt
字號:
如何在 Delphi 應用程序中, 去關閉外部已開啟的應用程序? (2000年7月28日)
本站更新 分類: 作者:srw 推薦: 閱讀次數:840
(http://www.codesky.net)
--------------------------------------------------------------------------------
下面給出一段在 Delphi 中關閉“計算器”程序為例:
...
var
HWndCalculator : HWnd;
begin
// find the exist calculator window
HWndCalculator := Winprocs.FindWindow(nil, '計算器');
// close the exist Calculator }
if HWndCalculator <> 0 then
SendMessage(HWndCalculator, WM_CLOSE, 0, 0);
end;
在此特意再摘錄一段 Win32 SDK 中的說明文字:
Typically, an application sends the WM_CLOSE message before
destroying awindow, giving the window the opportunity to
prompt the user for confirmation before the window is destroyed.
A window that includes a System menu automatically receives the
WM_CLOSE message when the user chooses the Close command from
the menu. If the user confirms that the window should be destroyed,
the application calls DestroyWindow. [END]
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -