#include "FiveWin.ch"
#define CLSCTX_ALL 0x17
#define LoadXML 66
#define CreateTileUpdaterForApplication 7
#define Update 7
function Main()
local oWnd
DEFINE WINDOW oWnd
ACTIVATE WINDOW oWnd ;
ON INIT Test( )
return nil
function Test()
local pString, cIID, cUIID, pTileUpdateManager, pXML, pTileNotificationFactory, pTileNotification, pTileUpdater
// F6D90F11-9C73-11D3-B32E-00C04F990BB4"
cIID = Chr( 0x11 ) + Chr( 0x0F ) + Chr( 0xD9 ) + Chr( 0xF6 ) + ;
Chr( 0x73 ) + Chr( 0x9C ) + Chr( 0xD3 ) + Chr( 0x11 ) + ;
Chr( 0xB3 ) + Chr( 0x2E ) + Chr( 0x00 ) + Chr( 0xC0 ) + ;
Chr( 0x4F ) + Chr( 0x99 ) + Chr( 0x0B ) + Chr( 0xB4 )
// 2933BF81-7B36-11d2-B20E-00C04F983E60
cUIID = Chr( 0x81 ) + Chr( 0xBF ) + Chr( 0x33 ) + Chr( 0x29 ) + ;
Chr( 0x36 ) + Chr( 0x7B ) + Chr( 0xd2 ) + Chr( 0x11 ) + ;
Chr( 0xB2 ) + Chr( 0x0E ) + Chr( 0x00 ) + Chr( 0xC0 ) + ;
Chr( 0x4F ) + Chr( 0x98 ) + Chr( 0x3E ) + Chr( 0x60 )
CoCreateInstance(cIID, 0, CLSCTX_ALL, cUIID, @pXML )
pString = WinRTString( '<tile>'+ ;
'<visual version="1">'+ ;
'<binding template="TileWideText03">'+ ;
'<text id="1">My first own wide tile notification!</text>'+ ;
'</binding>'+ ;
'<binding template="TileSquareText04">'+ ;
'<text id="1">My first own small tile notification!</text> '+ ;
'</binding>'+ ;
'</visual>'+ ;
'</tile>' )
WinRTMethod(pXML, LoadXML, pString, 0 )
WindowsDeleteString( pString );
pString = WinRTString( "Windows.UI.Notifications.TileNotification" )
// "C6ABDD6E-4928-46C8-BDBF-81A047DEA0D4"
cIID = Chr( 0x6E ) + Chr( 0xDD ) + Chr( 0xAB ) + Chr( 0xC6 ) + ;
Chr( 0x28 ) + Chr( 0x49 ) + Chr( 0xC8 ) + Chr( 0x46 ) + ;
Chr( 0xBD ) + Chr( 0xBF ) + Chr( 0x81 ) + Chr( 0xA0 ) + ;
Chr( 0x47 ) + Chr( 0xDE ) + Chr( 0xA0 ) + Chr( 0xD4 )
RoGetActivationFactory( pString, cIID, @pTileNotificationFactory )
WindowsDeleteString( pString )
#define CreateTileNotification 7
WinRTMethod(pTileNotificationFactory, CreateTileNotification, pXML, @pTileNotification )
pString = WinRTString( "Windows.UI.Notifications.TileUpdateManager" )
// "DA159E5D-3EA9-4986-8D84-B09D5E12276D"
cIID = Chr( 0x5D ) + Chr( 0x9E ) + Chr( 0x15 ) + Chr( 0xDA ) + ;
Chr( 0xA9 ) + Chr( 0x3E ) + Chr( 0x86 ) + Chr( 0x49 ) + ;
Chr( 0x8D ) + Chr( 0x84 ) + Chr( 0xB0 ) + Chr( 0x9D ) + ;
Chr( 0x5E ) + Chr( 0x12 ) + Chr( 0x27 ) + Chr( 0x6D )
RoGetActivationFactory( pString, cIID, @pTileUpdateManager )
WindowsDeleteString( pString ) //*/
WinRTMethod(pTileUpdateManager, CreateTileUpdaterForApplication, @pTileUpdater )
? pTileUpdater
if( pTileUpdater != 0)
WinRTMethod(pTileUpdater, Update, pTileNotification )
endif
return nil
function WinRTString( cText )
local pString
WindowsCreateString( AnsiToWide( cText ), Len( cText ), @pString )
return pString
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 CoCreateInstance( rclsid AS LPSTR, pUnkOuter AS PTR, dwClsContext AS DWORD, riid AS LPSTR, @ppv AS PTR ) ;
AS LONG PASCAL LIB "Ole32.dll"
#pragma BEGINDUMP
#include <Windows.h>
#include <hbapi.h>
#ifndef HB_LONGLONG
#define HB_LONGLONG long
#define hb_storvnll hb_stornl
#endif
typedef void * ( __stdcall * PMETHOD0 )( void * );
typedef void * ( __stdcall * PMETHOD1 )( void *, void * );
typedef void * ( __stdcall * PMETHOD2 )( void *, void *, void * );
HB_FUNC( WINRTMETHOD ) // pInspectable, nMethod, params...
{
IUnknown * unknown = ( IUnknown * ) hb_parnll( 1 );
void * pMethod = ( ( void ** ) unknown->lpVtbl )[ hb_parnl( 2 ) - 1 ];
IUnknown * pReturn;
switch( hb_pcount() )
{
case 3:
if( HB_ISBYREF( 3 ) )
hb_retnll( ( HB_LONGLONG ) ( ( PMETHOD1 ) pMethod )( unknown, &pReturn ) );
else
hb_retnll( ( HB_LONGLONG ) ( ( PMETHOD1 ) pMethod )( unknown, ( IUnknown * ) hb_parnll( 3 ) ) );
break;
case 4:
if( HB_ISBYREF( 4 ) )
hb_retnll( ( HB_LONGLONG ) ( ( PMETHOD2 ) pMethod )( unknown, ( void * ) hb_parnll( 3 ), &pReturn ) );
else
hb_retnll( ( HB_LONGLONG ) ( ( PMETHOD2 ) pMethod )( unknown, ( void * ) hb_parnll( 3 ), ( IUnknown * ) hb_parnll( 4 ) ) );
break;
}
if( HB_ISBYREF( 3 ) )
hb_storvnll( ( HB_LONGLONG ) pReturn, 3 );
if( HB_ISBYREF( 4 ) )
hb_storvnll( ( HB_LONGLONG ) pReturn, 4 );
}
#pragma ENDDUMP