Ver Mensaje Individual
  #9  
Antiguo 18-11-2009
Avatar de matabyte
matabyte matabyte is offline
Miembro
 
Registrado: ene 2008
Ubicación: Kyoto, Japon
Posts: 177
Reputación: 17
matabyte Va por buen camino
Me respondo después de muchísimas horas de búsqueda-intento-error.

He utilizado el GlobalGetName junto con el método de roman para poder pasar mensajes de una aplicación a otra con un único UID (si no, se manda a todas las ventanas el mensaje). He de decir que he conseguido mandar caracteres unicode con la versión llamada "GlobalGetAtomNamew" y "GlobalAddAtomw"

Aquí el procedimiento que manda el mensaje:
Código Delphi [-]
procedure Activar;
var
 txt:string;
 wparam:integer;
begin
  if ParamCount>0 then
   begin
     txt:=ParamStr(1)
   end
  else txt:='';

  wParam:=GlobalAddAtomw(pchar(txt));
  SendMessage(HWND_BROADCAST, mActivar, wParam, length(txt));
end;

Y aquí el que lo recibe

Código Delphi [-]
function AppWndProc(Handle: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LongInt; stdcall;
var
 st:string;
begin
  if Msg = mActivar then
  begin
      try
        setlength(st,lParam);
       GlobalGetAtomNamew(wParam,pchar(st),lParam);
       setlength(st,lParam);
      finally
        GlobalDeleteAtom(wParam);
      end;    
      if fileexists(st) then
       begin
          ....
       end;     
  end;
end;

Espero que os sirva tan bien como a mi
Responder Con Cita