Is it possible to show an icon in WebView not as a link to a file, but as a value (generate an icon from the source text) ?
For example
- Code: Select all Expand view RUN
- pol:=0
hBmp:=BmpFromIcon(EXTRACTASSICON( 0, "Name.pdf", @pol))
pol:=0
hBmp:=BmpFromIcon(EXTRACTASSICON( 0, "Name.pdf", @pol))
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
HB_FUNC( EXTRACTASSICON )
{
HICON hIcon;
LONG hInstance = hb_parnl( 1 );
char * lpIconPath = ( char * ) hb_parc( 2 );
WORD lpiIcon = hb_parnl( 3 );
hIcon = ExtractAssociatedIcon( ( HINSTANCE ) hInstance, lpIconPath, &lpiIcon );
hb_stornl( lpiIcon, 3 );
hb_retnl( ( LONG ) hIcon );
}
DLL32 FUNCTION ExtractAssociatedIcon( hIns AS LONG, cPth AS LPSTR, nInd AS LONG ) ;
AS LONG PASCAL FROM "ExtractAssociatedIconA" LIB "SHELL32.DLL"
XIMAGE( "name.pdf(256x256)" )
// Read icon --> bmp --> png formatted string
aBmp := FW_ReadImage( nil, ".pdf(32x32)" )
cPng := GDIP_BMP2PNGSTR( aBmp[ 1 ] )
PalBmpFree( aBmp )
//
// Use the class to prepare base64 tag
oImage64 := TImageBase64():New( cPng )
cTag := oImage64:MakeText( .f., .t., .f. )
oImage64:TestHtml() // if you want to test before using the tag
oImage64:TestHtml()
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 89 guests