Antonio Linares wrote:Este es el código modificado para que se muestre siempre. Puedes probarlo Victor ? :-)
#define FKG_FORCED_USAGE
#include <Windows.h>
#include <CommCtrl.h>
#include <hbapi.h>
#ifndef TTS_BALLOON
#define TTS_BALLOON 0x40
#endif
#ifndef TTF_TRANSPARENT
#define TTF_TRANSPARENT 0x0100
#endif
#ifndef TTF_IDISHWND
#define TTF_IDISHWND 0x0001
#endif
#ifndef TTM_SETMAXTIPWIDTH
#define TTM_SETMAXTIPWIDTH (WM_USER+24)
#endif
HMODULE GetResources( void );
#define CS_DROPSHADOW 0x00020000
HB_FUNC( CREATETOOLTIP ) // hWndParent, cText, lBallon --> hWndTooltip
{
TOOLINFO ti;
RECT rct;
HWND hWndParent = ( HWND ) ( LONG_PTR ) hb_parnll( 1 );
HWND hWnd = CreateWindowEx( 0, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX |
( hb_parl( 3 ) ? TTS_BALLOON: 0 ),
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
hWndParent, NULL, GetModuleHandle( NULL ),
NULL );
DWORD dwVersion = GetVersion();
DWORD dwWindowsMajorVersion = ( DWORD )( LOBYTE( LOWORD( dwVersion ) ) );
DWORD dwWindowsMinorVersion = ( DWORD )( HIBYTE( LOWORD( dwVersion ) ) );
if( ( dwWindowsMajorVersion >= 5 && dwWindowsMinorVersion >= 1 ) || ( dwWindowsMajorVersion >= 6 ) )
SetClassLong( hWnd, GCL_STYLE, GetClassLong( hWnd, GCL_STYLE ) | CS_DROPSHADOW );
GetClientRect ( hWndParent, &rct );
ti.cbSize = sizeof( TOOLINFO );
ti.uFlags = TTF_SUBCLASS | TTF_TRANSPARENT | TTF_IDISHWND;
ti.hwnd = hWndParent;
ti.hinst = GetModuleHandle( NULL );
ti.uId = (UINT_PTR) hWndParent; // Usamos el handle de la ventana como ID
ti.lpszText = ( LPSTR ) hb_parc( 2 );
ti.rect.left = rct.left;
ti.rect.top = rct.top;
ti.rect.right = rct.right;
ti.rect.bottom = rct.bottom;
SendMessage( hWnd, TTM_ADDTOOL, 0, ( LPARAM ) ( LPTOOLINFO ) &ti );
SendMessage( hWnd, TTM_ACTIVATE, TRUE, 0 );
SendMessage( hWnd, TTM_SETMAXTIPWIDTH, 0, 120 );
#ifndef _WIN64
hb_retnl( ( LONG ) hWnd );
#else
hb_retnll( ( LONGLONG ) hWnd );
#endif
}
He realizado la prueba con el código que has indicado y el comportamiento es el mismo, el codeblock se ejecuta ( escribe en el log ) pero no muestra el tooltip
#include "FiveWin.ch"
function Main()
local oWnd, oBtn
DEFINE WINDOW oWnd
@ 2, 4 BTNBMP oBtn PROMPT "Ok" SIZE 80, 20
oBtn:Disable()
oBtn:cTooltip = "hola"
oWnd:bMMoved = { || oBtn:ShowTooltip( 30, 30, oBtn:cTooltip ), hb_MemoWrit( 'test.log',Time()) }
ACTIVATE WINDOW oWnd CENTERED
return nil
#pragma BEGINDUMP
#define FKG_FORCED_USAGE
#include "C:\si\nlen\bcc74\include\windows\sdk\Windows.h"
#include "C:\si\nlen\bcc74\include\windows\sdk\CommCtrl.h"
#include <hbapi.h>
#ifndef TTS_BALLOON
#define TTS_BALLOON 0x40
#endif
#ifndef TTF_TRANSPARENT
#define TTF_TRANSPARENT 0x0100
#endif
#ifndef TTF_IDISHWND
#define TTF_IDISHWND 0x0001
#endif
#ifndef TTM_SETMAXTIPWIDTH
#define TTM_SETMAXTIPWIDTH (WM_USER+24)
#endif
HMODULE GetResources( void );
#define CS_DROPSHADOW 0x00020000
HB_FUNC( CREATETOOLTIP ) // hWndParent, cText, lBallon --> hWndTooltip
{
TOOLINFO ti;
RECT rct;
HWND hWndParent = ( HWND ) ( LONG_PTR ) hb_parnll( 1 );
HWND hWnd = CreateWindowEx( 0, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX |
( hb_parl( 3 ) ? TTS_BALLOON: 0 ),
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
hWndParent, NULL, GetModuleHandle( NULL ),
NULL );
DWORD dwVersion = GetVersion();
DWORD dwWindowsMajorVersion = ( DWORD )( LOBYTE( LOWORD( dwVersion ) ) );
DWORD dwWindowsMinorVersion = ( DWORD )( HIBYTE( LOWORD( dwVersion ) ) );
if( ( dwWindowsMajorVersion >= 5 && dwWindowsMinorVersion >= 1 ) || ( dwWindowsMajorVersion >= 6 ) )
SetClassLong( hWnd, GCL_STYLE, GetClassLong( hWnd, GCL_STYLE ) | CS_DROPSHADOW );
GetClientRect ( hWndParent, &rct );
ti.cbSize = sizeof( TOOLINFO );
ti.uFlags = TTF_SUBCLASS | TTF_TRANSPARENT | TTF_IDISHWND;
ti.hwnd = hWndParent;
ti.hinst = GetModuleHandle( NULL );
ti.uId = (UINT_PTR) hWndParent; // Usamos el handle de la ventana como ID
ti.lpszText = ( LPSTR ) hb_parc( 2 );
ti.rect.left = rct.left;
ti.rect.top = rct.top;
ti.rect.right = rct.right;
ti.rect.bottom = rct.bottom;
SendMessage( hWnd, TTM_ADDTOOL, 0, ( LPARAM ) ( LPTOOLINFO ) &ti );
SendMessage( hWnd, TTM_ACTIVATE, TRUE, 0 );
SendMessage( hWnd, TTM_SETMAXTIPWIDTH, 0, 120 );
#ifndef _WIN64
hb_retnl( ( LONG ) hWnd );
#else
hb_retnll( ( LONGLONG ) hWnd );
#endif
}
#pragma ENDDUMP