delphi 编程技巧

源代码在线查看: 如何在 delphi 应用程序中, 去关闭外部已开启的应.txt

软件大小: 774 K
上传用户: zyhunicom
关键词: delphi 编程技巧
下载地址: 免注册下载 普通下载 VIP

相关代码

				如何在 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]
				 
				 
							

相关资源