IonicWind Software

IWBasic => General Questions => Topic started by: mrainey on July 13, 2007, 07:35:04 AM

Title: ddoc and bitmap resources
Post by: mrainey on July 13, 2007, 07:35:04 AM
Has anybody been able to use a bitmap resource with the ddoc printing library?  It's easy to include a bitmap on the report by referring to a .bmp file, but I'd like to keep everything inside the executable if possible.
Title: Re: ddoc and bitmap resources
Post by: splakidas on July 13, 2007, 10:29:15 PM
Hi i use ddoc.
ddoc needs a handle to display a pic
DECLARE "ddoc32.dll", dpAddGraphic(iHandle:INT, zFileName:STRING),INT

i will see if its possible to display a resource pic
Title: Re: ddoc and bitmap resources
Post by: splakidas on July 13, 2007, 11:18:09 PM
mrainey  the problem is you have to use a path for your image

Declare Function dpAddGraphic Lib "ddoc32.dll"  ( ByVal iHandle%, ByVal zFileName$ ) as Long

Another solution is to extract the picture from your resource, use it with ddoc and delete it after you use the command.



hFile = dpStartDoc(0, "header txt", "", DDOC_CM, DDOC_PAPER_A4, DDOC_PORTRAIT, DDOC_BIN_LOWER, DDOC_ZOOMFIT|DDOC_ALLOWSAVE|DDOC_ALLOWSMTP|DDOC_ALLOWFAX)

.........................
extract resource code
http://www.codingmonkeys.com/index.php?action=dlattach;topic=558.0;attach=168 (http://www.codingmonkeys.com/index.php?action=dlattach;topic=558.0;attach=168)
.........................



uint xxx
xxx=dpAddGraphic(hFile, "c:/12.jpg")
dpDrawGraphic(hfile,xxx,1,1,5,5)   : rem <---------------display your pic
...........................
delete pic
...........................

dpEndDoc (hFile, endCode  )



Title: Re: ddoc and bitmap resources
Post by: mrainey on July 14, 2007, 04:54:00 AM
The resource extraction sub works great!  The rest should be something I can handle.

Thanks, splakidas and Paul.