Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > API de Windows
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 03-03-2008
Avatar de ArdiIIa
[ArdiIIa] ArdiIIa is offline
Miembro Premium
 
Registrado: nov 2003
Ubicación: Valencia city
Posts: 1.481
Poder: 24
ArdiIIa Va por buen camino
jeje...
Me parece que el asunto tiene mas miga del que parece.

En principio a mi se me ocurrió hacer un SetWindowLong interfiriendo en proceso Wnd de la ventana del reloj, interceptar los mensajes y ya está.
Fácil verdad ?

Pues mira por donde la cosa parece algo mas compleja...

En principio parece inviable lo que proponía a pelo, a no ser que se meta un gancho o Hook a la aplicación que queremos interferir, y para esto tal como he podido ver, se necesita un DLL para enganchar al relojito.

Buscando y buscando he encontrado en Delphi-PRAXIS el código que te pongo aquí (para que no se pierda) que en realidad es el inicio de lo que necesitas. En este ejemplo se controla únicamente si se pulsa el ratón y saca un mensaje. En tu WndProc deberías controlar creo el WM_MOUSEMOVE y actuar en consecuencia..................... que creo que no va a ser poniendo y texto sin mas....


El código:

Código Delphi [-]
library ClockHook;

var
  g_hhook: THandle;
  hwndTaskbar, hwndTray, g_hwndClock: hwnd;
  idThread: dword;

  g_bInitClock: boolean = false;

  g_oldWndProc, g_hInst: THandle;


procedure RefreshRebar(myHwnd: hwnd);
var
  hhwnd: hwnd;
begin
  if myHwnd > 0 then
  begin
    InvalidateRect(myHwnd, nil, TRUE);
    hhwnd := GetWindow(myHwnd, GW_CHILD);
    while hhwnd > 0 do
    begin
      InvalidateRect(hhwnd, nil, TRUE);
      hhwnd := GetWindow(hhwnd, GW_HWNDNEXT);
    end;
  end;
end;

procedure RefreshTaskbar(myHwnd: hwnd);
var
  hwndTaskbar, hwndRebar, hwndTray, hwndStartButton: hwnd;
begin
  hwndTray := GetParent(myHwnd);
  hwndTaskbar := GetParent(hwndTray);
  hwndRebar := FindWindowEx(hwndTaskbar, 0, 'ReBarWindow32', nil);
  hwndStartButton := FindWindowEx(hwndTaskbar, 0, 'Button', nil);

  InvalidateRect(hwndStartButton, nil, TRUE);
  InvalidateRect(hwndTray, nil, TRUE);
  PostMessage(hwndTray, WM_SIZE, SIZE_RESTORED, 0);

  RefreshRebar(hwndRebar);
  PostMessage(hwndRebar, WM_SIZE, SIZE_RESTORED, 0);
  InvalidateRect(hwndTaskbar, nil, TRUE);
  PostMessage(hwndTaskbar, WM_SIZE, SIZE_RESTORED, 0);
end;

function WndProc(hWnd: HWND; uMsg: UINT; wParam: wParam; lParam: LParam): lresult; stdcall;
begin
  case uMsg of
    WM_LBUTTONDOWN: MessageBoxA(0, 'Left mouse button', 'Test', 0);
  end;

  result := CallWindowProc(@g_oldWndProc, hWnd, uMsg, wParam, lParam);
end;

procedure InitClock(myHwnd: hwnd);
begin
  if g_bInitClock then exit;
  g_bInitClock := true;

  g_oldWndProc := GetWindowLong(myHwnd, GWL_WNDPROC);
  SetWindowLong(myHwnd, GWL_WNDPROC, LongInt(@WndProc));
  RefreshTaskbar(myHwnd);
end;

function CallWndProc(ncode: integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
var
  pcwps: PCWPSTRUCT;
begin
  pcwps := PCWPSTRUCT(lParam);

  if (ncode = HC_ACTION) then
  begin
    if (not g_bInitClock) and (pcwps.hwnd = g_hwndClock) then
      InitClock(pcwps.hwnd);
  end;

  result := CallNextHookEx(g_hhook, ncode, wParam, lParam);
end;

function StartHook(): boolean; stdcall;
begin
  g_hInst := GetModuleHandle('ClockHook.dll');

  hwndTaskbar := FindWindow('Shell_TrayWnd', nil);
  hwndTray := FindWindowEx(hwndTaskbar, 0, 'TrayNotifyWnd', nil);
  g_hwndClock := FindWindowEx(hwndTray, 0, 'TrayClockWClass', nil);
  idThread := GetWindowThreadProcessId(hwndTaskbar, nil);
 
  g_hhook := SetWindowsHookEx(WH_CALLWNDPROC, @CallWndProc, g_hInst, idThread);
 
  PostMessage(hwndTaskbar, WM_SIZE, SIZE_RESTORED, 0);
 
  result := true;
end;

function StopHook(): boolean; stdcall;
begin
  SetWindowLong(killhwnd, GWL_WNDPROC, g_oldWndProc);
  g_oldWndProc := 0;
  RefreshTaskbar(killhwnd);

  result := UnhookWindowsHookEx(g_hhook);
  g_hhook := 0;
end;

exports
  StartHook,
  StopHook;
         
begin
end.

Llama la atención que la captura del Wndproc de la ventanita en cuestión lo hace en el procedimiento InitClock.

A partir de ahí, creo tal como digo que no va a bastar con cambiar simplemente un texto del hint, sino que además vas a tener que crear una ventanita tipo Thint con el texto a exhibir.
No se me ocurre como enviarle un CM_HINTSHOW de la VCL.

Seguro que muchos de los ASES que tenemos aquí cuando lean esto, encuentran una solución al asunto, pero creo que lo te pongo es el inicio.

Un saludo estruendoso con petardos...
__________________
Un poco de tu generosidad puede salvar la vida a un niño. ASÍ DE SENCILLO
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Hint en DBlookupListBox luchomarfil OOP 1 16-10-2007 14:16:15
Hint en un TStatusPanel ixMike OOP 4 11-05-2007 19:23:37
Hint /*+ Append*/ AngelMarvin Oracle 0 04-04-2006 16:45:26
Hint (Urgente !!!) jymy788 Varios 2 16-09-2004 16:18:27
Propiedad Hint Javier_A OOP 1 28-11-2003 14:55:53


La franja horaria es GMT +2. Ahora son las 07:06:38.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi