调用api函数
FindWindow
FindWindowEX

解决方案 »

  1.   

    var
      hwndsbsz:hwnd;
    begin
       hwndsbsz:=findwindow(nil,pchar(''); //引号中为另一应用程序的Application.Title,
     即该程序运行时在任务栏上的名称   if hwndsbsz <> 0  then
          application.MessageBox('模块正在运行中!','提示',mb_ok);
    end;
      

  2.   

    需要列表所有进程,然后可根据名称来进行判别
    给你一段Nt下的代码吧(整个单元)!unit u_CheckProcess;interfaceuses Windows, Classes, PsApi;function CheckProcess(aProcessName: string): Boolean;//exename(no path,eg hello.exe)
    implementationfunction CheckProcess(aProcessName: string): Boolean;
    type
      integer = DWORD; // different versions of psapi.pas floating around
    var
      i, pidNeeded: Integer;
      PIDList: array[0..1000] of Integer; // 1000 should be enough
      PIDName: array[0..MAX_PATH - 1] of char;
      PH: THandle;
    begin
      Result := False;
      if not Psapi.EnumProcesses(@PIDList, 1000, pidNeeded) then
      begin
        Result := False;
        exit;
      end;
      for i := 0 to (pidNeeded div sizeof(Integer) - 1) do
      begin
        PH := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False,
          PIDList[i]);
        if PH <> 0 then
        begin
          if psapi.GetModuleBaseName(PH, 0, PIDName, sizeof(PIDName)) > 0 then
            if aProcessName = pidName then
            begin
              Result := True;
            end;
          if PH > 0 then
            CloseHandle(PH);
        end;
      end;
    end;end.
      

  3.   

    应该是这样写的,我很久没用这段代码了!(取自Deja.com)