Ver Mensaje Individual
  #8  
Antiguo 02-01-2004
chavetaz chavetaz is offline
Miembro
 
Registrado: oct 2003
Ubicación: Buenos Aires, Argentina
Posts: 29
Reputación: 0
chavetaz Va por buen camino
Lightbulb

Ya lo tengo solucionado, las primeras pruebas parecen favorables, ejecuto el siguiente codigo y me devuelve el path de la ventana del windows explorer que tuvo el foco por ultima vez, o sea de cuatro ventanas de windows explorer abiertas me duvuelve la que estuvo mas al frente recientemente, seguramente se pueda optimizar el codigo pero basicamente es este:

function TForm1.GetPath: String;
var
win, toolbar, comboboxex, worker:hwnd;
begin
win := FindWindow(pchar('CabinetWClass'),nil);
worker := FindWindowEx(win,0,'WorkerW',nil);
toolbar := FindWindowEx(worker,0,'rebarwindow32',nil);
comboboxex := FindWindowEx(toolbar, 0, 'comboboxex32', nil);
result := GetText(comboboxex);
end;

function TForm1.GetText(WindowHandle: hwnd): string;
var
txtLength : integer;
buffer: string;
begin
TxtLength := SendMessage(WindowHandle, WM_GETTEXTLENGTH, 0, 0);
txtlength := txtlength + 1;
setlength (buffer, txtlength);
sendmessage (WindowHandle,wm_gettext, txtlength, longint(@buffer[1]));
result := buffer;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(GetPath);
end;

muchas gracias a todos por su ayuda!
Responder Con Cita