La función Toast() usa funciones propias de WinRT basado en Windows.UI y no es nada estandard ni fácil de modificar.
Te adjunto aqui todo el código por si quieres revisarlo. He consultado con DeepSeek para ver si se puede hacer lo que quieres pero no parece dar una solución clara.
Comentarte que Cristobal implementó la Clase TToast en FWH y que usándola puedes tener mucho mas control aunque esa clase también tiene un nivel de complejidad.
Code: Select all | Expand
#include "FiveWin.ch"
#define Show 7
#define CreateToastNotification 7
#define CreateToastNotifierWithId 8
#define Item 8
#define GetNamedItem 9
#define GetTemplateContent 9
#define add_Activated 12
#define CreateTextNode 12
#define Get_Attributes 17
#define GetElementsByTagName 17
#define AppendChild 23
//---------------------------------------------------------------------------//
function WinRTString( cText )
local pString
WindowsCreateString( AnsiToWide( cText ), Len( cText ), @pString )
return pString
//---------------------------------------------------------------------------//
static function SetNodeText( pNodeList, nItem, cText, pXml )
local pXmlNode, pXmlText, pXmlNodeChild
local pString
WinRTMethod( pNodeList, Item, nItem, @pXmlNode )
pString = WinRTString( cText )
WinRTMethod( pXml, CreateTextNode, pString, @pXmlText )
WindowsDeleteString( pString )
WinRTMethod( pXmlNode, AppendChild, pXmlText, @pXmlNodeChild )
return nil
//---------------------------------------------------------------------------//
static function SetImageFileName( pXml, cImageFileName )
local pString := WinRTString( "image" )
local pNodeList, pXmlNode, pAttributeMap
local pXmlNodeAttribute, pXmlText, pXmlNodeChild
WinRTMethod( pXml, GetElementsByTagName, pString, @pNodeList )
WindowsDeleteString( pString )
WinRTMethod( pNodeList, Item, 0, @pXmlNode )
WinRTMethod( pXmlNode, Get_Attributes, @pAttributeMap )
pString = WinRTString( "src" )
WinRTMethod( pAttributeMap, GetNamedItem, pString, @pXmlNodeAttribute )
WindowsDeleteString( pString )
pString = WinRTString( cImageFileName )
WinRTMethod( pXml, CreateTextNode, pString, @pXmlText )
WindowsDeleteString( pString )
WinRTMethod( pXmlNodeAttribute, AppendChild, pXmlText, @pXmlNodeChild )
return nil
//---------------------------------------------------------------------------//
function Toast( cFirstLine, cSecondLine, cThirdLine, cImageFileName )
local pString, cIID, pToastFactory
local pXml, pNodeList
local pNotification, pNotificationFactory, pNotifier
DEFAULT cFirstLine := "FiveWin notification",;
cSecondLine := " ", cThirdLine := " ",;
cImageFileName := "c:\fwh\bitmaps\pngs\fivetech.png"
RoInitialize( 1 )
pString = WinRTString( "Windows.UI.Notifications.ToastNotificationManager" )
// "50AC103F-D235-4598-BBEF-98FE4D1A3AD4"
cIID = Chr( 0x3F ) + Chr( 0x10 ) + Chr( 0xAC ) + Chr( 0x50 ) + ;
Chr( 0x35 ) + Chr( 0xD2 ) + Chr( 0x98 ) + Chr( 0x45 ) + ;
Chr( 0xBB ) + Chr( 0xEF ) + Chr( 0x98 ) + Chr( 0xFE ) + ;
Chr( 0x4D ) + Chr( 0x1A ) + Chr( 0x3A ) + Chr( 0xD4 )
RoGetActivationFactory( pString, cIID, @pToastFactory )
WindowsDeleteString( pString );
WinRTMethod( pToastFactory, GetTemplateContent, 3, @pXml )
SetImageFileName( pXml, cImageFileName )
pString = WinRTString( "text" )
WinRTMethod( pXml, GetElementsByTagName, pString, @pNodeList )
WindowsDeleteString( pString )
SetNodeText( pNodeList, 0, cFirstLine, pXml )
SetNodeText( pNodeList, 1, cSecondLine, pXml )
SetNodeText( pNodeList, 2, cThirdLine, pXml )
// 04124B20-82C6-4229-B109-FD9ED4662B53
cIID = Chr( 0x20 ) + Chr( 0x4B ) + Chr( 0x12 ) + Chr( 0x04 ) + ;
Chr( 0xC6 ) + Chr( 0x82 ) + Chr( 0x29 ) + Chr( 0x42 ) + ;
Chr( 0xB1 ) + Chr( 0x09 ) + Chr( 0xFD ) + Chr( 0x9E ) + ;
Chr( 0xD4 ) + Chr( 0x66 ) + Chr( 0x2B ) + Chr( 0x53 )
pString = WinRTString( "Windows.UI.Notifications.ToastNotification" )
RoGetActivationFactory( pString, cIID, @pNotificationFactory )
WindowsDeleteString( pString )
WinRTMethod( pNotificationFactory, CreateToastNotification, pXML, @pNotification )
pString = WinRTString( " " )
WinRTMethod( pToastFactory, CreateToastNotifierWithId, pString, @pNotifier )
WindowsDeleteString( pString )
// pEventHandler = WinRTEventHandler()
// WinRTMethod( pNotification, add_Activated, pEventHandler, nEventToken )
// MsgInfo( WinRTEventToken() )
// WinRTMethod( pNotification, add_Activated + 1, pEventHandler, nEventToken )
// MsgInfo( WinRTEventToken() )
// WinRTMethod( pNotification, add_Activated + 2, pEventHandler, nEventToken )
// MsgInfo( WinRTEventToken() )
WinRTMethod( pNotifier, Show, pNotification )
RoUninitialize()
return nil
//---------------------------------------------------------------------------//
DLL FUNCTION RoInitialize( nType AS LONG ) AS LONG PASCAL LIB "combase.dll"
DLL FUNCTION RoUninitialize() AS VOID PASCAL LIB "combase.dll"
DLL FUNCTION WindowsCreateString( cWideText AS LPSTR, nLength AS LONG, @pString AS PTR ) ;
AS LONG PASCAL LIB "combase.dll"
DLL FUNCTION WindowsDeleteString( pString AS PTR ) AS LONG PASCAL LIB "combase.dll"
DLL FUNCTION RoGetActivationFactory( pString AS PTR, REFIID AS LPSTR, @pFactory AS PTR ) ;
AS LONG PASCAL LIB "combase.dll"
DLL FUNCTION WindowsGetStringRawBuffer( pString AS PTR, @nLenght AS LONG ) ;
AS LONG PASCAL LIB "combase.dll"