Suppose I include a help file in the resource file:
CFILE RCDATA HELP.CHM
I want to run this HELP.CHM directly in the program,How do I write code?
How do I run files contained in resource files directly
Moderator: Rathinagiri
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: How do I run files contained in resource files directly
Hi Huiyi
Not all type of file usable in resource file, resource manner;
please look at: http://www.hmgforum.com/viewtopic.php?f=24&t=2291
Happy HMG'ing
Viva INTERNATIONAL HMG
- serge_girard
- Posts: 3166
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: How do I run files contained in resource files directly
Hi Huiyi,
What you can do is following: include in RC:
RC file: (example)
Prg file:
I hope this can serve you!
Serge
What you can do is following: include in RC:
RC file: (example)
Code: Select all
README RCDATA read_me.txt
libmysql RCDATA c:\hmg.3.0.44\libmysql.dll
Code: Select all
#Include <hmg.ch>
Function Main()
LOCAL cFileRes := ResToFile("README")
MsgInfo(cFileRes)
cFileRes := ResToFile("libmysql")
IF !FILE('libmysql.dll')
STRFILE(HMG_LoadResourceRawFile ( 'libmysql', RT_RCDATA ),'libmysql.dll')
ENDIF
Return Nil
#pragma BEGINDUMP
#include <Windows.h>
#include <hbApi.h>
HB_FUNC( RESTOFILE )
{
static HRSRC hr;
static HGLOBAL hg;
hr = FindResource( NULL, (LPSTR) hb_parc( 1 ), RT_RCDATA );
if( ! ( hr == 0 ) )
{
hg = LoadResource( NULL, hr );
if( ! ( hg == 0 ) )
{
char *lpRcData=( char *)LockResource( hg );
hb_retc( lpRcData );
}
}
}
#pragma ENDDUMP
Serge
There's nothing you can do that can't be done...
Re: How do I run files contained in resource files directly
Thank you Serge and esgici
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How do I run files contained in resource files directly
Super. Thank you Esgici and Serge.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- serge_girard
- Posts: 3166
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: How do I run files contained in resource files directly
Rathi,
It was just some copy and paste from several samples from this forum...
Especially including the libmysql.dll was for great interest of me because it isn't standard included and in all my programs I need it.
Serge
It was just some copy and paste from several samples from this forum...
Especially including the libmysql.dll was for great interest of me because it isn't standard included and in all my programs I need it.
Serge
There's nothing you can do that can't be done...