var ExeHandle:Thandle; begin //获得句柄-->标题不确定 ExeHandle:=FindWindow('notepad',nil);//'');//返回句柄 //关闭程序 if ExeHandle<>0 then SendMessage(ExeHandle,WM_Close,0,0) else Application.MessageBox('没有打开“记事本”程序!','提示', MB_IconInformation+MB_OK); end;
var ExeHandle:Thandle; begin //获得句柄-->标题不确定 ExeHandle:=FindWindow(nil,'想关闭的程序的标题');//关闭程序 if ExeHandle<>0 then SendMessage(ExeHandle,WM_Close,0,0) end;
ShellExecute(handle, NULL, path_to_folder, NULL, NULL, SW_SHOWNORMAL);
or
ShellExecute(handle, "open", path_to_folder, NULL, NULL, SW_SHOWNORMAL);
关闭时 sendmessage wm_close
begin
//获得句柄-->标题不确定
ExeHandle:=FindWindow('notepad',nil);//'');//返回句柄
//关闭程序
if ExeHandle<>0 then
SendMessage(ExeHandle,WM_Close,0,0)
else
Application.MessageBox('没有打开“记事本”程序!','提示',
MB_IconInformation+MB_OK);
end;
关闭的方法好象不行
begin
//获得句柄-->标题不确定
ExeHandle:=FindWindow(nil,'想关闭的程序的标题');//关闭程序
if ExeHandle<>0 then
SendMessage(ExeHandle,WM_Close,0,0)
end;