如题。

解决方案 »

  1.   

    用timmer的ONTIMMER事件调用另一个程序就行了
    用WINEXEC()调用
      

  2.   

    同意  ghtghtmalone(malone)
    当然你还要控制多少时间后那个程序被关闭
      

  3.   

    还是不太明白,在Timer中调用另一个程序?不是需要检测内存中运行的我要重启的程序吗?若存在则关闭重启,不存在则直接重启。该怎么办?
      

  4.   

    在你的TIMER事件中
    h:= findwindow('标题',nil);
    if h>0 then  sendmessage(h,wm_close,0,0);
    winexec('文件名称',sw_show);
      

  5.   

    为什么在Delphi中显示findwindow没有定义
      

  6.   

    [Error] Unit1.pas(35): Undeclared identifier: 'wm_keypress'
      

  7.   

    findwindow是Windows API函数啊,你在USES中应该添加SHELLAPI。
      

  8.   

    在sendmessage(h,wm_keypress,#13,0);这句中出现以下错误:[Error] Unit1.pas(35): Undeclared identifier: 'wm_keypress'[Error] Unit1.pas(35): Undeclared identifier: 'wm_keypress'
      

  9.   

    出现这个编译错误
    [Error] Unit1.pas(37): Incompatible types: 'Integer' and 'Char'
      

  10.   

    前面问题已得到解决,现在只留下如何自动按回车键,上面的sendmessage(h,wm_keypress,#13,0);和sendMessage(h,wm_KeyDown,0,#13)都不行
      

  11.   

    靠这么写就好了
     //模拟鼠标单击事件
         x是你的句柄
         SendMessage(x,WM_LBUTTONDOWN,wParam(MK_LBUTTON),MAKEWORD(0,0));
         SendMessage(x,WM_LBUTTONUP,WPARAM(MK_LBUTTON),MAKEWORD(0,0));
      要是非要用 WM_KEYDOWN 你也要现看看他的帮助呀 
    nVirtKey = (int) wParam;    // virtual-key code 
    lKeyData = lParam;          // key data 
    能这么写吗? sendmessage(h,wm_keypress,#13,0);
         
      

  12.   

    RE :还有就是如何获得程序的标题啊?
    int GetWindowText(
        HWND hWnd, // handle of window or control with text
        LPTSTR lpString,// address of buffer for text 这个你可以直接定义成PCHAR
        int nMaxCount  // maximum number of characters to copy
       );
    // pchar-->string
       strpas();