Hola amigos,
Existira alguna manera de almacenar imagenes JPG en una archivo .RES ?? PellesC solo admite bmp y francamente son muy pesados...
Salu2
if FindResource( GetResources(), "JPG_1", 10 )
cJpg = cResToStr( "JPG_1", 10 )
MsgInfo( Len( cJpg ) )
endif
#include "FiveWin.ch"
#define RT_RCDATA 10
function Main()
local oDlg, oHand, oBmp1
local cJpg
DEFINE DIALOG oDlg RESOURCE "Test"
REDEFINE IMAGE oBmp1 ID 110 OF oDlg
if Len( cJpg := cResToStr( "JPG_1", RT_RCDATA ) ) != 0
oBmp1:LoadFromMemory( cJpg )
endif
ACTIVATE DIALOG oDlg CENTERED
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
HINSTANCE GetResources( void );
HB_FUNC( CRESTOSTR ) // ( cnResName, cType ) --> cResourceBytes
{
HGLOBAL hglb;
LPCTSTR lpName;
LPCTSTR lpType;
HRSRC hRes;
if( HB_ISNUM( 1 ) )
lpName = ( LPCSTR ) hb_parnl( 1 );
else
lpName = ( LPCSTR ) hb_parc( 1 );
lpType = MAKEINTRESOURCE( hb_parni( 2 ) );
hRes = FindResource( GetResources(), lpName, lpType );
if( hRes )
{
hglb = LoadResource( GetResources(), hRes );
if( hglb )
hb_retclen( ( LPSTR ) LockResource( hglb ), SizeofResource( GetResources(), hRes ) );
else
hb_retc( "" );
}
else
hb_retc( "" );
}
#pragma ENDDUMP
#define RT_RCDATA 10
JPG_1 RT_RCDATA NONDISCARDABLE "olga1.jpg"
test DIALOG 17, 36, 235, 260
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "TestMap"
FONT 8, "MS Sans Serif"
{
CONTROL "", 110, "TImage", WS_CHILD | WS_VISIBLE, 0, 0, 235, 300
}
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 44 guests