分不多,但是恳请大家帮帮我(20分)

  • 主题发起人 主题发起人 cxd110
  • 开始时间 开始时间
C

cxd110

Unregistered / Unconfirmed
GUEST, unregistred user!
我想在我的程序里关闭已经打开的Powerpoint,但是要出现一个是否要保存的对话框,<br>我想能否自动按下否或则不出现此对话框
 
帮帮你,可能用的上:<br>function &nbsp;findhnd(handle:thandle;lparam:lparam):boolean;stdcall;<br>var<br>l:integer;<br>name:pchar;<br>a:string;<br>buffer:array [0..255] of char;<br>begin<br>result:=true;<br>&nbsp; &nbsp;getclassname(handle,buffer,256);<br>&nbsp; &nbsp;a:=strpas(buffer);<br>&nbsp; &nbsp;if StrPas(buffer)='TButton' then &nbsp; &nbsp;//查找对应的类<br>&nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp; l:=sendmessage(handle,WM_GETTEXTLENGTH,0,0)+1;<br>&nbsp; &nbsp; &nbsp; &nbsp; GetMem(Name,L);<br>&nbsp; &nbsp; &nbsp; &nbsp; SendMessage(handle,WM_GETTEXT,l,integer(Name));<br>&nbsp; &nbsp; &nbsp; &nbsp; a:=strpas(name);<br>&nbsp; &nbsp; &nbsp; &nbsp;if strpas(name)='Button2' then &nbsp; &nbsp; &nbsp; &nbsp; //查找对应的名称<br>&nbsp; &nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp;pinteger(lparam)^:=handle;<br>&nbsp; &nbsp; &nbsp; &nbsp;result:=false;<br>&nbsp; &nbsp; &nbsp; &nbsp;end;<br>&nbsp; &nbsp; &nbsp; &nbsp;FreeMem(name,0);<br>&nbsp; &nbsp; &nbsp;end;<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>hnd:thandle;<br>begin<br>&nbsp; hnd:=findwindow(nil,'Form2');<br>&nbsp; if hnd&lt;&gt;0 then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; EnumChildWindows(hnd,@findhnd,integer(@hnd));<br>&nbsp; &nbsp; &nbsp; sendmessage(hnd,WM_LBUTTONDOWN,0,0);<br>&nbsp; &nbsp; &nbsp; sendmessage(hnd,WM_LBUTTONUP,0,0);<br>&nbsp; &nbsp; end;<br><br>end;
 
在word中直接保存并关闭是这样的,在PowerPoint中你可以模仿:<br><br>Msword.FileSaveAs('abc.doc');<br>Msword.DocClose;//关闭文件<br>Msword.Appclose;//直接退出
 
后退
顶部