Page 2 of 17
Re: PDF Viewer DLL?
Posted: Mon Feb 13, 2017 10:29 pm
by Roberto Lopez
Thanks. I'll take a look at it.
Re: PDF Viewer DLL?
Posted: Tue Feb 14, 2017 12:51 pm
by PeteWG
Roberto Lopez wrote: ↑Mon Feb 13, 2017 10:28 pm
The only possible issue is that the user could click outside Sumatra window, being overlapped by HMG app, but, This could be solved using: EXECUTE FILE ... WAIT
Hi Roberto
you can use
-plugin switch which give the ability to make SumatraPDF
a child window of a given window, f.e. a window of your application.
In this way you have absolute control!
please see here
https://github.com/sumatrapdfreader/sum ... -arguments
(scroll down to "Developer options")
I have done it for one of my minigui applications and works ok.
I'm pretty sure you will easily realize how to make it,
however, If you need any details, about the way I have implemented it, I 'd be happy to provide them.
P.S. yes, SumatraPDF it's a very good piece of opensource software!
best regards,
---
Pete
Re: PDF Viewer DLL?
Posted: Tue Feb 14, 2017 1:22 pm
by mol
Extra!
PDF Viewer DLL?
Posted: Tue Feb 14, 2017 1:47 pm
by Pablo César
Yeah nice news !
Re: PDF Viewer DLL?
Posted: Wed Feb 15, 2017 12:59 am
by Roberto Lopez
PeteWG wrote: ↑Tue Feb 14, 2017 12:51 pm
Hi Roberto
you can use
-plugin switch which give the ability to make SumatraPDF
a child window of a given window, f.e. a window of your application.
In this way you have absolute control!
<...>
Thanks!
This morning I've was reading the document you point (Sumatra at GitHub) and (for some reason) I've missed '-plugin' option
As you said, this way, we are in full control of the users experience, without caring about PDF support available on their systems.
Thanks again!
Re: PDF Viewer DLL?
Posted: Wed Feb 15, 2017 1:24 am
by Roberto Lopez
And... a step further...
Since I like that ny apps be self-contained (a single exe file) I'm thinking on embed Sumatra portable on my source code and create it (if it does not exists) in the destination machine (a crazy idea... I know
).
I guess that I should create an utility that reads the binary file (Sumatra exe) and creates the source code of a Harbour array, containing an element for each byte in the binary (maybe using HEX).
Since I'm trying to not reinvent the wheel (if not strictly needed) my question is: Does such utility exists?
TIA.
Re: PDF Viewer DLL?
Posted: Wed Feb 15, 2017 3:08 am
by srvet_claudio
Roberto Lopez wrote: ↑Wed Feb 15, 2017 1:24 am
And... a step further...
Since I like that ny apps be self-contained (a single exe file) I'm thinking on embed Sumatra portable on my source code and create it (if it does not exists) in the destination machine (a crazy idea... I know
).
I guess that I should create an utility that reads the binary file (Sumatra exe) and creates the source code of a Harbour array, containing an element for each byte in the binary (maybe using HEX).
Since I'm trying to not reinvent the wheel (if not strictly needed) my question is: Does such utility exists?
TIA.
Roberto,
1) embed your file as raw resource ( resource type ID are defined in i_controlmisc.ch ):
MyRawRes RT_RCDATA MyfileX.exe
2) load resource:
cData := HMG_LoadResourceRawFile ( "MyRawRes", RT_RCDATA )
3) save the resource:
hFile := FCreate("MyFile.exe")
Fwrite( hFile, cData )
FClose( hFile )
Re: PDF Viewer DLL?
Posted: Wed Feb 15, 2017 3:21 am
by andyglezl
by Roberto Lopez » Tue Feb 14, 2017 6:24 pm
Since I like that ny apps be self-contained (a single exe file) I'm thinking on embed Sumatra portable on my source code and create it (if it does not exists) in the destination machine (a crazy idea... I know
).
Hola a todos
Yo ya tenía un tiempo que no participaba...
Roberto
Esa "loca idea" yo también la tuve hace algún tiempo y después de probar y probar y probar,
logre hacerlo de esta forma. (NOTA: solo que el archivo pesaba 529 kb)
Espero que les sirva
-------------------------------------------------------------------------------------------------------------------
Hello everyone
I already had a time that did not participate ...
Robert
That "crazy idea" I also had it some time ago and after trying and testing and trying,
Can do it this way. (NOTE: only the file weighed 529 kb)
I hope it works for you
MiArchivo.RC
-------------------------------------------
MIARCH TXT miarchivo.exe
-------------------------------------------
en mi programa...
-------------------------------------------
FUNCTION CreaExe( )
LOCAL xData1
xData1 := HMG_LoadResourceRawFile( "MIARCH", "TXT" )
HB_MEMOWRIT( "miarchivo.exe", xData1 )
RETURN nil
Re: PDF Viewer DLL?
Posted: Wed Feb 15, 2017 6:21 am
by mol
Attach small working sample when it will be ready, please
Re: PDF Viewer DLL?
Posted: Wed Feb 15, 2017 10:37 am
by PeteWG
Roberto Lopez wrote: ↑Wed Feb 15, 2017 1:24 am
Since I'm trying to not reinvent the wheel (if not strictly needed) my question is: Does such utility exists?
TIA.
No need to reinvent "this wheel"!
I would never stop to say that "harbour has it all" (or almost all, anyway)
Personally, I do use a #pragma trick to attach binaries (or anything) to the final executable.
f.e. in one application that makes use of "curl.exe" I did:
Code: Select all
#include "fileio.ch"
-------------------------------------------------------------------------------------------------
IF ! hb_vfExists( "curl.exe" )
hb_MemoWrit( "curl.exe", CurlExe() )
// give OS a little time to "see" the newly created file
hb_IdleSleep( 0.5 )
// hide the file from user's sight to protect it from "accidents"
hb_vfAttrSet( "curl.exe", HB_FA_HIDDEN + HB_FA_READONLY + HB_FA_SYSTEM )
ENDIF
STATIC FUNCTION CurlExe()
#pragma __binarystreaminclude "CURL.EXE" | RETURN %s
--------------------------------------------------------------------------------------------------
NOTE: the binary that is going to be attached, must be available and visible during compile/link time, so I put it into project's /source folder.
NOTE 2: it's obvious that the attached file is piling up onto the final executable, and in the case of sumatraPDF (latest portable version is about ~6.5MiB), this attaching-technic will significantly affect the size of the executable with all the contingent consequences that such a growth may have during runtime.
best regards,
---
Pete