Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi 检查PSQLDBC是否已从系统中卸载_Delphi_Postgresql_Odbc - Fatal编程技术网

Delphi 检查PSQLDBC是否已从系统中卸载

Delphi 检查PSQLDBC是否已从系统中卸载,delphi,postgresql,odbc,Delphi,Postgresql,Odbc,我正在开发需要PSQLDBC驱动程序和Postgressql9.0数据库的软件, 我们有一个使用Delphi7设计的安装程序,可以静默地安装PSQLDBC和postgreSQl 9 一个接一个地点击一个按钮,这里一切正常, 但问题是在卸载过程中, 我首先要安装PSQLDBC,然后还要在sinlge按钮上单击postgreSQl 9 我只想在取消PSQLDBC后使用shellpApi运行postgreSQl 9 unistaller, 到目前为止,我正在检查“cmd.exe”是否正在运行,以启动p

我正在开发需要PSQLDBC驱动程序和Postgressql9.0数据库的软件, 我们有一个使用Delphi7设计的安装程序,可以静默地安装PSQLDBC和postgreSQl 9 一个接一个地点击一个按钮,这里一切正常, 但问题是在卸载过程中, 我首先要安装PSQLDBC,然后还要在sinlge按钮上单击postgreSQl 9

我只想在取消PSQLDBC后使用shellpApi运行postgreSQl 9 unistaller, 到目前为止,我正在检查“cmd.exe”是否正在运行,以启动postgreSQl卸载程序,但有时在取消安装PSQLDBC后,“cmd.exe”仍处于n状态,postgreSQl unistaller无法执行

有什么事请告诉我 如何检查PSQLDBC卸载过程是否已完成

这些文件是 1.psqlobc.msi 2.postgresql-9.0.2-1-windows.exe

安装/卸载由bat文件处理


高级版谢谢:)

如果驱动程序可用,您可以检查注册表。安装后,您将获得:

c:\tmp\pg>reg query "hklm\SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL ANSI"

! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL ANSI
    APILevel    REG_SZ  1
    ConnectFunctions    REG_SZ  YYN
    Driver      REG_SZ  C:\Program Files\psqlODBC\0900\bin\psqlodbc30a.dll
    DriverODBCVer       REG_SZ  03.00
    FileUsage   REG_SZ  0
    Setup       REG_SZ  C:\Program Files\psqlODBC\0900\bin\psqlodbc30a.dll
    SQLLevel    REG_SZ  1
    UsageCount  REG_DWORD       0x1
当您安装它时,您将获得(本地化版本):

(此menas:错误:系统在注册表中找不到项或值)

请参阅:
reg/?
,了解如何使用它以及可批量使用的返回代码


您还可以在
HKLM\Software\Microsoft\Windows\CurrentVersion\uninstall

下搜索注册表卸载信息。我了解了如何检查psqlobc是否已完全卸载,以便可以开始卸载postgres

为此,我找到了解决办法

因此,第1步
如果ExecAndWait('msiexec/x C:\psqlodbc09\psqlodbc.msi'),那么
开始
//卸载postgresNow。。。!!
结束;

嘿,你的想法不错,但问题是在unistall过程中注册表项被删除了。。。但unistaller当时仍在运行,我想知道的是,如何知道PSQLDBC unistall进程是否已完全完成……我正在使用此batc文件来unistaller PSQLDBC驱动程序……”msiexec/x C:\psqlodbc09\psqlodbc.msi“我编辑了我的问题,。。。。。我可以检查“msiexec”进程是否正在运行,但在卸载过程中,其中3个“msiexec”正在运行,但在卸载后,一个“msiexec”仍在运行,即使PSQLDBC卸载已完成。!!。。。。。我还可以检查“cmd.exe”,但在一个案例中,我发现即使在Unistall之后,“cmd.exe”仍在运行,因此您必须计算
msiexec
进程数。在我的系统进程上,Explorer显示了这类进程的完整命令行:
“C:\WINDOWS\System32\msiexec.exe”/i“C:\tmp\pg\psqlobc.msi”
,但很难获取命令行参数。好的,这也是检查msiexec计数的一个解决方案
c:\tmp\pg>reg query "hklm\SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL ANSI"

Błąd: system nie może odnaleźć określonego klucza rejestru lub wartości.

c:\tmp\pg>
function TForm1.ExecAndWait(const CommandLine: string) : Boolean;
var
 StartupInfo: Windows.TStartupInfo;        // start-up info passed to process
 ProcessInfo: Windows.TProcessInformation; // info about the process
 ProcessExitCode: Windows.DWord;           // process's exit code
  begin 
    // Set default error result
    Result := False;
  // Initialise startup info structure to 0, and record length
   FillChar(StartupInfo, SizeOf(StartupInfo), 0);
   StartupInfo.cb := SizeOf(StartupInfo);
 // Execute application commandline
   if Windows.CreateProcess(nil, PChar(CommandLine),
   nil, nil, False, 0, nil, nil,
   StartupInfo, ProcessInfo) then
 begin
   try
    // Now wait for application to complete
     if Windows.WaitForSingleObject(ProcessInfo.hProcess, INFINITE)
      = WAIT_OBJECT_0 then
      // It's completed - get its exit code
      if Windows.GetExitCodeProcess(ProcessInfo.hProcess,
       ProcessExitCode) then
       // Check exit code is zero => successful completion
      if ProcessExitCode = 0 then
         Result := True;
   finally
  // Tidy up
   Windows.CloseHandle(ProcessInfo.hProcess);
   Windows.CloseHandle(ProcessInfo.hThread);
  end;
  end;
 end;