Detectar Firebird no Vista
Como posso saber se o Firebird está rodando no Windows Vista? No XP eu consigo fazer, mas o código não dá certo para o Windows Vista. Segue o código que eu utilizo.
E chamo a função da seguinte forma:
Alguém pode me dar uma luz??
function CheckForMutexes(Mutexes: String): Boolean;
{ Returns True if any of the mutexes in the comma-separated Mutexes string
exist }
var
I: Integer;
M: String;
H: THandle;
begin
Result := False;
repeat
I := Pos(´,´, Mutexes);
if I = 0 then
begin
I := Maxint;
end;
M := Trim(Copy(Mutexes, 1, I-1));
if M <> ´´ then
begin
H := OpenMutex(SYNCHRONIZE, False, PChar(M));
if H <> 0 then
begin
CloseHandle(H);
Result := True;
Break;
end;
end;
Delete(Mutexes, 1, I);
until Mutexes = ´´;
end;
function FirebirdDefaultServerRunning2(N1, N2, N3, N4, N5: String): string;
var
Handle: Integer;
mutex_found: boolean;
begin
result := ´´;
//Look for a running version of Firebird 1.5 or later
// Handle := FindWindowByClassName(´FB_Disabled´);
Handle := FindWindow(PChar(N1){´FB_Disabled´}, nil);
if ( Handle = 0 ) then
begin
Handle := FindWindow(PChar(N2){´FB_Server´}, nil);
end;
if ( Handle = 0 ) then
begin
Handle := FindWindow(PChar(N3){´FB_Guard´}, nil);
end;
if (Handle > 0) then
begin
result := ´1.5´;
end
else
begin
mutex_found := CheckForMutexes(PChar(N4){´FirebirdGuardianMutex,FirebirdServerMutex´});
if mutex_found then
begin
result := ´2.0´;
end
else
begin
mutex_found := CheckForMutexes(PChar(N5){´FirebirdGuardianMutexDefaultInstance,FirebirdServerMutexDefaultInstance´});
if mutex_found then
begin
result := ´2.1´
end;
end;
end;
end;
E chamo a função da seguinte forma:
Is_FB_Running := (´2.1´ = FirebirdDefaultServerRunning2(´FB_Disabled´, ´FB_Server´, ´FB_Guard´, ´FirebirdGuardianMutex,FirebirdServerMutex´, ´FirebirdGuardianMutexDefaultInstance,FirebirdServerMutexDefaultInstance´))
Alguém pode me dar uma luz??
Daniel Grillo
Curtidas 0
Respostas
Daniel Grillo
10/02/2009
Up
GOSTEI 0
Daniel Grillo
10/02/2009
up
GOSTEI 0
Daniel Grillo
10/02/2009
Ninguém???
GOSTEI 0
Daniel Grillo
10/02/2009
Alguém poderia me ajudar???
GOSTEI 0