Ver Mensaje Individual
  #4  
Antiguo 23-10-2006
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Reputación: 26
seoane Va por buen camino
Yo sigo contestándote en Delphi, espero que no te moleste Para encontrar todas las ventanas tenemos dos opciones, utilizar un bucle con la función FindWindowEx o usar la función EnumWindows. Te pongo las dos y decide tu.

Usando FindWindowEx en un bucle:
Código Delphi [-]
var
  Ventana: THandle;
begin
  Ventana:= FindWindowEx(0,0,'IMClass',nil);
  if Ventana > 0 then
  repeat
    // Si la ventana es visible la ocultamos y viceversa
    if isWindowVisible(Ventana) then
      ShowWindow(Ventana,SW_HIDE)
    else
      ShowWindow(Ventana,SW_SHOW);
    Ventana:= FindWindowEx(0,Ventana,'IMClass',nil);
  until Ventana = 0;
end;

Usando la función EnumWindows:
Código Delphi [-]
function EnumWindowsProc(Handle: Thandle; lParam: LPARAM): BOOL; stdcall;
var
  Buffer: PChar;
  Size: Integer;
begin
  Result:= TRUE;
  if PChar(lParam) <> nil then
  begin
    Size:= Strlen(PChar(lParam)) + 1;
    GetMem(Buffer,Size);
    try
      FillChar(Buffer^,Size,0);
      GetClassName(Handle,Buffer,Size);
      if StrIcomp(PChar(lParam), Buffer) = 0 then
        if isWindowVisible(Handle) then
          ShowWindow(Handle,SW_HIDE)
        else
          ShowWindow(Handle,SW_SHOW);
    finally
      Freemem(Buffer);
    end;
  end;
end;

// Para llamar la funcion
EnumWindows(@EnumWindowsProc, LPARAM(PChar('IMClass')));
Responder Con Cita