Ver Mensaje Individual
  #2  
Antiguo 30-05-2014
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola mblascog.

Intenta de este modo:
Código Delphi [-]
...
implementation

uses Registry;

function IsWOW64: Boolean;
type
  LPFN_ISWOW64PROCESS = function(hProcess: THandle; var Wow64Process: BOOL): BOOL; stdcall;
var
  fnIsWow64Process: LPFN_ISWOW64PROCESS;
  bIsWOW64: BOOL;
begin
  Result:= False;
  fnIsWow64Process:= LPFN_ISWOW64PROCESS(GetProcAddress(GetModuleHandle('kernel32'), 'IsWow64Process'));
  if Assigned(fnIsWow64Process) then
  begin
    bIsWow64:= False;
    if fnIsWow64Process(GetCurrentProcess(), bIsWOW64) then
      Result:= bIsWOW64;
  end;
end;

function GetConnectStrFromDSN(const DSNStr: string): string;
const
  KEY_WOW64_64KEY = $0100;
begin
  Result:= '';
  with TRegistry.Create(KEY_READ + KEY_WOW64_64KEY * Integer(IsWOW64)) do
  try
    RootKey:= HKEY_LOCAL_MACHINE;
    if OpenKey('\SOFTWARE\ODBC\ODBC.INI', False) then
    begin
      Result:= ReadString(DSNStr);
      CloseKey;
    end;
  finally
    Free;
  end;
end;

Ej. llamada:
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage(GetConnectStrFromDSN('Iris'));
end;

Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 30-05-2014 a las 14:11:47.
Responder Con Cita