Tengo este procedimiento que obtuve de el foro, k es para ejecutar con shellexecute:
Código Delphi
[-]
procedure EjecutarPrograma(rutaPrograma,
parametros: string; esperar: boolean);
var
salida: DWord;
punteroInfo: PShellExecuteInfo;
infoEjecucion: TShellExecuteInfo;
begin
with infoEjecucion do
begin
cbSize := SizeOf(infoEjecucion);
fMask := SEE_MASK_NOCLOSEPROCESS;
wnd := GetActiveWindow;
lpVerb := nil;
lpFile := PChar(rutaPrograma);
lpParameters := Pchar(parametros + #0);
lpDirectory := nil;
nShow := SW_NORMAL;
hInstApp := 0;
end;
punteroInfo:= @infoEjecucion;
ShellExecuteEx(punteroInfo);
if esperar then
repeat
salida := WaitForSingleObject(infoEjecucion.hProcess, 500);
Application.ProcessMessages;
until (salida <> WAIT_TIMEOUT);
end;
y la mando llamar de la siguiente forma:
Código Delphi
[-]
EjecutarPrograma('osql','-L',true);
osql -L me trae en lina de comandos los Servidores SQL en la red.
Algo asi:
Código:
c:\>osql -L
Servers:
(local)
EB0
EB3
EB8
Lo que quiero es traer esa consulta a delphi ya sea en un listbox o en un combobox, para asi elegir a k servidor voy a realizar la conexión.
Espero k me puedan ayudar.