I am now the proud owner of PureBasic. I purchased it yesterday and have everything installed and up and running.
I hope to find some time in the remainder of this weekend to mess-around with it some.
My first major task is to do the following:
1) Get PB to work with the Tsunami Record Manager
2) Get PB to work with the dDoc Print/Preview control
When I get these two tasks done I will be all set to start porting my VB6 shareware application to PB.
I cannot wait. I am pretty excited about the possibilites that PB is bringing to the table for me.
In case anyone was wandering...
-
Noble Bell
- User

- Posts: 34
- Joined: Sun Jun 04, 2006 8:49 pm
- Location: Kentucky, USA
- Contact:
Re: In case anyone was wandering...
Welcome!
Good programmers don't comment their code. It was hard to write, should be hard to read.
Re: In case anyone was wandering...
first, welcome to you.Noble Bell wrote:My first major task is to do the following:
1) Get PB to work with the Tsunami Record Manager
about tsunami, there are some old posts on this forum:
http://www.purebasic.fr/english/viewtop ... ht=tsunami
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
- DoubleDutch
- Addict

- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Here is the code you will need to use DDoc Print and Preview with V4:
Be aware that I haven't used all of the calls so some are untested. It would also be better if it was all converted to Prototypes (its currently just quick fix from v3 to v4).
Code: Select all
; PureBasic Interface for the ddoc Print and Preview Engine
; Errors returned by dpStartDoc
#DDOC_NOHANDLES = -1
#DDOC_BADFILE = -2
#DDOC_FILEEXISTS = -3
; Status Codes returned by dpMailInit
Enumeration
#DDOC_MAIL_SUCCESS
#DDOC_MAIL_FNF
#DDOC_MAIL_LNF
#DDOC_MAIL_NOH
#DDOC_MAIL_HEIGHT_INVALID
#DDOC_MAIL_WIDTH_INVALID
#DDOC_MAIL_LABHEIGHT_INVALID
#DDOC_MAIL_LABWIDTH_INVALID
#DDOC_MAIL_COL_INVALID
#DDOC_MAIL_ROW_INVALID
#DDOC_MAIL_LINES_INVALID
EndEnumeration
; Unit of measure constants as passed to dpStartDoc
Enumeration
#DDOC_INCH
#DDOC_CM
EndEnumeration
; This can be passed in any of these iOptions parameters in
; dpStartDoc or dpEndDoc:
; Paper / Orientation / Bin
; If passed, then ddoc will respect
; the user's choice of orientation And Bin (Or the system
; defaults if not specified by the user).
#DDOC_SYSTEM_DEFAULT = -1
#DDOC_SAME_AS_FIRST = -2
#DDOC_PAPER_CUSTOM = -3 ; use custom paper size
; Orientation Constants for use with dpStartDoc
Enumeration
#DDOC_PORTRAIT
#DDOC_LANDSCAPE
EndEnumeration
; Paper Bin Constants used in dpStartDoc and dpNewPage
Enumeration 1
#DDOC_BIN_ONLYONE
#DDOC_BIN_LOWER
#DDOC_BIN_MIDDLE
#DDOC_BIN_MANUAL
#DDOC_BIN_ENVELOPE
#DDOC_BIN_ENVMANUAL
#DDOC_BIN_AUTO
#DDOC_BIN_TRACTOR
#DDOC_BIN_SMALLFMT
#DDOC_BIN_LARGEFMT
#DDOC_BIN_LARGECAPACITY
#DDOC_BIN_CASSETTE = 14
EndEnumeration
#DDOC_BIN_LAST = #DDOC_BIN_CASSETTE
#DDOC_BIN_UPPER = #DDOC_BIN_ONLYONE
#DDOC_BIN_FIRST = #DDOC_BIN_ONLYONE
; Paper Size Constants used in dpStartDoc and dpNewPage
Enumeration 1
#DDOC_PAPER_LETTER ; Letter 8 1/2 x 11 in
#DDOC_PAPER_LETTERSMALL ; Letter Small 8 1/2 x 11 in
#DDOC_PAPER_TABLOID ; Tabloid 11 x 17 in
#DDOC_PAPER_LEDGER ; Ledger 17 x 11 in
#DDOC_PAPER_LEGAL ; Legal 8 1/2 x 14 in
#DDOC_PAPER_STATEMENT ; Statement 5 1/2 x 8 1/2 in
#DDOC_PAPER_EXECUTIVE ; Executive"7 1/2 x 10 in
#DDOC_PAPER_A3 ; A3 297 x 420 mm
#DDOC_PAPER_A4 ; A4 210 x 297 mm
#DDOC_PAPER_A4SMALL ; A4 Small 210 x 297 mm
#DDOC_PAPER_A5 ; A5 148 x 210 mm
#DDOC_PAPER_B4 ; B4 250 x 354
#DDOC_PAPER_B5 ; B5 182 x 257 mm
#DDOC_PAPER_FOLIO ; Folio 8 1/2 x 13 in
#DDOC_PAPER_QUARTO ; Quarto 215 x 275 mm
#DDOC_PAPER_10x14 ; 10x14 in
#DDOC_PAPER_11X17 ; 11x17 in
#DDOC_PAPER_NOTE ; Note 8 1/2 x 11 in
#DDOC_ENV_9 ; Envelope #9 3 7/8 x 8 7/8
#DDOC_ENV_10 ; Envelope #10 4 1/8 x 9 1/2
#DDOC_ENV_11 ; Envelope #11 4 1/2 x 10 3/8
#DDOC_ENV_12 ; Envelope #12 4 \276 x 11
#DDOC_ENV_14 ; Envelope #14 5 x 11 1/2
#DDOC_ENV_DL = 27 ; Envelope DL 110 x 220mm
#DDOC_ENV_C5 ; Envelope C5 162 x 229 mm
#DDOC_ENV_C3 ; Envelope C3 324 x 458 mm
#DDOC_ENV_C4 ; Envelope C4 229 x 324 mm
#DDOC_ENV_C6 ; Envelope C6 114 x 162 mm
#DDOC_ENV_C65 ; Envelope C65 114 x 229 mm
#DDOC_ENV_B4 ; Envelope B4 250 x 353 mm
#DDOC_ENV_B5 ; Envelope B5 176 x 250 mm
#DDOC_ENV_B6 ; Envelope B6 176 x 125 mm
#DDOC_ENV_ITALY ; Envelope 110 x 230 mm
#DDOC_ENV_MONARCH ; Envelope Monarch 3.875 x 7.5 in
#DDOC_ENV_PERSONAL ; 6 3/4 Envelope 3 5/8 x 6 1/2 in
#DDOC_FANFOLD_US ; US Std Fanfold 14 7/8 x 11 in
#DDOC_FANFOLD_STD_GERMAN ; German Std Fanfold 8 1/2 x 12 in
#DDOC_FANFOLD_LGL_GERMAN ; German Legal Fanfold 8 1/2 x 13 in
EndEnumeration
; dpStartDoc Option Constants
#DDOC_VIEWBUILD = 1
#DDOC_ALLOWFAX = 2
#DDOC_ALLOWMAPI = 4
#DDOC_ALLOWSAVE = 8
#DDOC_ZOOMWIDTH = 64
#DDOC_ZOOMFIT = 128
#DDOC_ZOOM75 = 256
#DDOC_ZOOM100 = 512
#DDOC_ZOOM125 = 1024
#DDOC_SCALETEXT = 2048
#DDOC_FASTTEXT = 0
#DDOC_SAVE_EXE_ONLY = 4096
#DDOC_ALLOWSMTP = 8192
; Constants For dpDuplex
#DDOC_DUPLEX_HORIZONTAL = 16384
#DDOC_DUPLEX_VERTICAL = 32768
; Font Style Bit-wise constats for the dpFont call
#DDOC_FONTNORMAL = 0
#DDOC_FONTBOLD = 1
#DDOC_FONTITALIC = 2
#DDOC_FONTUNDERLINE = 4
#DDOC_FONTSTRIKEOUT = 8
#DDOC_FONTBASELINE = 16
; dpEndDoc Option constants
#DDOC_END_VIEW = 0
#DDOC_END_PRINT = 1
#DDOC_END_CLOSE = 2
#DDOC_END_DELETE = 4
#DDOC_END_PRINT_NODIALOG = 8
#DDOC_END_FAX = 16
#DDOC_END_EMAIL = 32
#DDOC_END_SPECIFIC_PRINTER = 64
#DDOC_END_CREATE_EXE = 128
; Text alignment constants for dpText, dpPageNo, dpPageCount
Enumeration
#DDOC_LEFT
#DDOC_CENTER
#DDOC_RIGHT
#DDOC_DECIMAL
EndEnumeration
; Error codes for dpSelfExtract
#DDOC_INPUT_NOT_FOUND = -5
#DDOC_OUTPUT_EXISTS = -4
#DDOC_ERR_OPEN_INPUT = -3
#DDOC_ERROR_OPEN_OUTPUT = -2
#DDOC_ERROR_OPEN_STUB = -1
#DDOC_SUCCESS = 0
; Button codes to Assign hints (captions) to buttons
; these will normally be used only by International users
; to replace the English INTs on the screen. Used by
; the dpCaption function
Enumeration
#DDOC_INIT_WORDS ; Initialization flag
#DDOC_MENU_FILE ; File Menu
#DDOC_MENU_DOC ; Document Menu
#DDOC_BTN_EXIT ; Exit button hint and exit menu
#DDOC_BTN_FIRST ; First Button hint and menu
#DDOC_BTN_PREV ; Previous Button hint and menu
#DDOC_BTN_NEXT ; Next button hint and menu
#DDOC_BTN_LAST ; Last Button hint and menu
#DDOC_BTN_JUMP ; Jump Button hint and menu
#DDOC_BTN_PRINT ; Print hint and menu
#DDOC_WORD_ZOOM ; Zoom label caption
#DDOC_WORD_ZOOMFIT ; Zoom Fit INT in drop down
#DDOC_WORD_ZOOMWIDTH ; Zoom Width in drop down
#DDOC_WORD_DOCINDEX ; INT Document index
#DDOC_WORD_PAGE ; Page
#DDOC_WORD_OF ; of
#DDOC_DLG_JUMP_TITLE ; jump dialog title
#DDOC_DLG_JUMP_TEXT ; dialog jump text
#DDOC_BTN_CANCEL ; cancel button
#DDOC_BTN_OK ; ok button
#DDOC_DLG_PW_TITLE ; passINT box title
#DDOC_DLG_PW_TEXT ; passINT text in dialog
#DDOC_DLG_PW_INVALID ; passINT is invalid (try again)
#DDOC_DLG_PW_CANCEL ; passINT invalid (3 strikes and you:'re out)
#DDOC_BTN_EMAIL ; email button
#DDOC_BTN_FAX ; fax button
#DDOC_BTN_SAVE ; save button
EndEnumeration
Global ddoc_libno
; Prototypes
Prototype.f dpProtoTextWidth(iHandle.l,Asciiz$)
Global dpTextWidth.dpProtoTextWidth
Procedure StartDDoc()
ddoc_libno=OpenLibrary(#PB_Any,"ddoc32.dll")
If ddoc_libno
dpTextWidth=GetFunction(ddoc_libno,"dpTextWidth")
EndIf
ProcedureReturn ddoc_libno
EndProcedure
Procedure StopDDoc()
If ddoc_libno
CloseLibrary(ddoc_libno)
ddoc_libno=0
EndIf
EndProcedure
; Document generation
Procedure dpStartDoc(hParent,zTitle$,zFile$,iUOM,iPaper,iOrient,iBin,iOptions)
ProcedureReturn CallFunction(ddoc_libno,"dpStartDoc",hParent,@zTitle$,@zFile$,iUOM,iPaper,iOrient,iBin,iOptions)
EndProcedure
Procedure dpNewPage(iHandle,iPaper,iOrient,iBin)
ProcedureReturn CallFunction(ddoc_libno,"dpNewPage",iHandle,iPaper,iOrient,iBin)
EndProcedure
Procedure dpBookmark(iHandle,zBookmark$)
ProcedureReturn CallFunction(ddoc_libno,"dpBookmark",iHandle,@zBookmark$)
EndProcedure
Procedure dpEndDoc(iHandle,iOptions)
ProcedureReturn CallFunction(ddoc_libno,"dpEndDoc",iHandle,iOptions)
EndProcedure
Procedure dpEndDocInst()
ProcedureReturn CallFunction(ddoc_libno,"dpEndDocInst")
EndProcedure
Procedure dpGetFileName(iHandle,zDoc$,iLen)
ProcedureReturn CallFunction(ddoc_libno,"dpGetFileName",iHandle,@zDoc$,iLen)
EndProcedure
Procedure dpChangeWords(iHandle,iWhich,zText$)
ProcedureReturn CallFunction(ddoc_libno,"dpChangeWords",iHandle,iWhich,zText$)
EndProcedure
Procedure dpSelfExtract(zInputFile$,zDDOC$,zOutEXE$)
ProcedureReturn CallFunction(ddoc_libno,"dpSelfExtract",@zInputFile$,@zDDOC$,@zOutEXE$)
EndProcedure
Procedure dpCheckAbort(iHandle)
ProcedureReturn CallFunction(ddoc_libno,"dpCheckAbort",iHandle)
EndProcedure
Procedure dpSetProgress(iHandle,iProgress)
ProcedureReturn CallFunction(ddoc_libno,"dpSetProgress",iHandle,iProgress)
EndProcedure
Procedure dpSetTabs(iHandle,zTabStops$)
ProcedureReturn CallFunction(ddoc_libno,"dpSetTabs",iHandle,@zTabStops$)
EndProcedure
Procedure dpTabText(iHandle,y.f,zText$)
ProcedureReturn CallFunction(ddoc_libno,"dpTabText",iHandle,@y,@zText$)
EndProcedure
; Document Options
Procedure dpSetPassword(iHandle,zPassword$)
ProcedureReturn CallFunction(ddoc_libno,"dpSetPassword",iHandle,@zPassword$)
EndProcedure
Procedure dpSetScreenOptions(iHandle,x,y,x2,y2,iMaximize)
ProcedureReturn CallFunction(ddoc_libno,"dpSetScreenOptions",iHandle,x,y,x2,y2,iMaximize)
EndProcedure
Procedure dpSetAttachExt(iHandle,zExt$)
ProcedureReturn CallFunction(ddoc_libno,"dpSetAttachExt",iHandle,@zExt$)
EndProcedure
Procedure dpSetEMailOptions(iHandle,zLogon$,zPassword$,zNames$,zAddress$,zSubject$,zNote$,iShowDialog,iMailSelfExtract)
ProcedureReturn CallFunction(ddoc_libno,"dpSetEMailOptions",iHandle,@zLogon$,@zPassword$,@zNames$,@zAddress$,@zSubject$,@zNote$,iShowDialog,iMailSelfExtract)
EndProcedure
Procedure dpSetFaxOptions(iHandle,zLogon$,zPassword$,zRecip$,zSubject$,zNote$,iShowDialog)
ProcedureReturn CallFunction(ddoc_libno,"dpSetFaxOptions",iHandle,@zLogon$,@zPassword$,@zRecip$,@zSubject$,@zNote$,iShowDialog)
EndProcedure
Procedure dpSMTPOptionsProcedure(hParent)
ProcedureReturn CallFunction(ddoc_libno,"dpSMTPOptionsProcedure",hParent)
EndProcedure
Procedure dpDuplexProcedure(iHandle,iHow)
ProcedureReturn CallFunction(ddoc_libno,"dpDuplexProcedure",iHandle,iHow)
EndProcedure
Procedure dpPaperSizeProcedure(iHandle,sgWidth,sgHeight)
ProcedureReturn CallFunction(ddoc_libno,"dpPaperSizeProcedure",iHandle,sgWidth,sgHeight)
EndProcedure
; Font and Text Functions
Procedure dpFont(iHandle,iStyle,Size.f,iColor,zFontName$)
ProcedureReturn CallFunction(ddoc_libno,"dpFont",iHandle,iStyle,Size,iColor,@zFontName$)
EndProcedure
Procedure dpText(iHandle,x.f,y.f,iAlign,zText$)
ProcedureReturn CallFunction(ddoc_libno,"dpText",iHandle,x,y,iAlign,@zText$)
EndProcedure
Procedure dpSpecialText(iHandle,x.f,y.f,iAlign,zText$)
ProcedureReturn CallFunction(ddoc_libno,"dpSpecialText",iHandle,x,y,iAlign,@zText$)
EndProcedure
Procedure dpFontSpacing(iHandle,dblPoints)
ProcedureReturn CallFunction(ddoc_libno,"dpFontSpacing",iHandle,dblPoints)
EndProcedure
Procedure dpWrapText(iHandle,x.f,y.f,x2.f,y2.f,leading.f,zText$)
ProcedureReturn CallFunction(ddoc_libno,"dpWrapText",iHandle,x,y,x2,y2,leading,@zText$)
EndProcedure
Procedure dpWrapContinue(iHandle,x.f,y.f,x2.f,y2.f,leading.f)
ProcedureReturn CallFunction(ddoc_libno,"dpWrapContinue",iHandle,x,y,x2,y2,leading)
EndProcedure
Procedure dpWrapCount(iHandle)
ProcedureReturn CallFunction(ddoc_libno,"dpWrapCount",iHandle)
EndProcedure
Procedure dpAngleText(iHandle,x.f,y.f,iAngle,zText$)
ProcedureReturn CallFunction(ddoc_libno,"dpAngleText",iHandle,x,y,iAngle,@zText$)
EndProcedure
Procedure dpClipText(iHandle,x.f,y.f,w,iAlign,zText$)
ProcedureReturn CallFunction(ddoc_libno,"dpClipText",iHandle,x,y,w,iAlign,@zText$)
EndProcedure
Procedure dpPageOffset(iHandle,iOffset)
ProcedureReturn CallFunction(ddoc_libno,"dpPageOffset",iHandle,iOffset)
EndProcedure
Procedure dpPageNo(iHandle,x.f,y.f,iAlign,iAngle)
ProcedureReturn CallFunction(ddoc_libno,"dpPageNo",iHandle,x,y,iAlign,iAngle)
EndProcedure
Procedure dpPageCount(iHandle,x.f,y.f,iAlign,iAngle)
ProcedureReturn CallFunction(ddoc_libno,"dpPageCount",iHandle,x,y,iAlign,iAngle)
EndProcedure
; Procedure.f dpTextWidth(iHandle,Asciiz$)
; CallFunction(ddoc_libno,"dpTextWidth",iHandle,Asciiz$)
; EndProcedure
; Lines and Graphics
Procedure dpLine(iHandle,x.f,y.f,x2.f,y2.f,w.f,c)
ProcedureReturn CallFunction(ddoc_libno,"dpLine",iHandle,x,y,x2,y2,w,c)
EndProcedure
Procedure pArc(iHandle,x.f,y.f,x2.f,y2.f,aStart.f,aEnd.f,w.f,iColor)
ProcedureReturn CallFunction(ddoc_libno,"pArc",iHandle,x,y,x2,y2,aStart,aEnd,w,iColor)
EndProcedure
Procedure dpPie(iHandle,x.f,y.f,x2.f,y2.f,aStart.f,aEnd.f,w.f,ilineColor,ifillColor)
ProcedureReturn CallFunction(ddoc_libno,"dpPie",iHandle,x,y,x2,y2,aStart,aEnd,w,ilineColor,ifillColor)
EndProcedure
Procedure dpRect(iHandle,x.f,y.f,x2.f,y2.f,w.f,iFillColor,iBorderColor)
ProcedureReturn CallFunction(ddoc_libno,"dpRect",iHandle,x,y,x2,y2,w,iFillColor,iBorderColor)
EndProcedure
Procedure dpEllipse(iHandle,x.f,y.f,x2.f,y2.f,w.f,iFillColor,iBorderColor)
ProcedureReturn CallFunction(ddoc_libno,"dpEllipse",iHandle,x,y,x2,y2,w,iFillColor,iBorderColor)
EndProcedure
Procedure dpRoundRect(iHandle,x.f,y.f,x2.f,y2.f,roundW.f,roundH.f,w.f,iColor,iBorderColor)
ProcedureReturn CallFunction(ddoc_libno,"dpRoundRect",iHandle,x,y,x2,y2,roundW,roundH,w,iColor,iBorderColor)
EndProcedure
Procedure dpGraphic(iHandle,x.f,y.f,x2.f,y2.f,zFileName$)
ProcedureReturn CallFunction(ddoc_libno,"dpGraphic",iHandle,x,y,x2,y2,@zFileName$)
EndProcedure
Procedure dpEmbedGraphicProcedure(iHandle,x.f,y.f,x2.f,y2.f,zFileName$)
ProcedureReturn CallFunction(ddoc_libno,"dpEmbedGraphicProcedure",iHandle,x,y,x2,y2,@zFileName$)
EndProcedure
Procedure dpAddGraphic(iHandle,zFile$)
ProcedureReturn CallFunction(ddoc_libno,"dpAddGraphic",iHandle,@zFile$)
EndProcedure
Procedure dpDrawGraphic(iHandle,hBitmap,x.f,y.f,x2.f,y2.f)
ProcedureReturn CallFunction(ddoc_libno,"dpDrawGraphic",iHandle,hBitmap,x,y,x2,y2)
EndProcedure
Procedure dpStretchMode(iHandle,iStretch)
ProcedureReturn CallFunction(ddoc_libno,"dpStretchMode",iHandle,iStretch)
EndProcedure
; Printer Handling
Procedure dpPrinterCount()
ProcedureReturn CallFunction(ddoc_libno,"dpPrinterCount")
EndProcedure
Procedure.s dpGetPrinter(iWhich)
ProcedureReturn PeekS(CallFunction(ddoc_libno,"dpGetPrinter",iWhich))
EndProcedure
Procedure dpIsPrinter(zPrinter$)
ProcedureReturn CallFunction(ddoc_libno,"dpIsPrinter",@zPrinter$)
EndProcedure
Procedure dpSpecifyPrinter(iWhich,zPrinter$)
ProcedureReturn CallFunction(ddoc_libno,"dpSpecifyPrinter",iWhich,@zPrinter$)
EndProcedure
Procedure dpPrinterCopies(iWhich,iCopies)
ProcedureReturn CallFunction(ddoc_libno,"dpPrinterCopies",iWhich,iCopies)
EndProcedure
; Mailing Label API
Procedure dpMailInit(iHandle,szIniFile$,szIniSection$,nAlign)
ProcedureReturn CallFunction(ddoc_libno,"dpMailInit",iHandle,@szIniFile$,@szIniSection$,nAlign)
EndProcedure
Procedure dpLabelLines(iHandle)
ProcedureReturn CallFunction(ddoc_libno,"dpLabelLines",iHandle)
EndProcedure
Procedure dpLabelsPerPage(iHandle)
ProcedureReturn CallFunction(ddoc_libno,"dpLabelsPerPage",iHandle)
EndProcedure
Procedure dpLabelText(iHandle,szLabelLine$)
ProcedureReturn CallFunction(ddoc_libno,"dpLabelText",iHandle,@szLabelLine$)
EndProcedure
Procedure dpNextLabel(iHandle)
ProcedureReturn CallFunction(ddoc_libno,"dpNextLabel",iHandle)
EndProcedure
Procedure dpSetLabelLine (iHandle,nLabelLine)
ProcedureReturn CallFunction(ddoc_libno,"dpSetLabelLine",iHandle,nLabelLine)
EndProcedure
Procedure dpSetLabel(iHandle,nLabelNumber)
ProcedureReturn CallFunction(ddoc_libno,"dpSetLabel",iHandle,nLabelNumber)
EndProcedure
Procedure dpPrintTemplate(iHandle,LabAlign)
ProcedureReturn CallFunction(ddoc_libno,"dpPrintTemplate",iHandle,LabAlign)
EndProcedure
Procedure.f dpLabelX(iHandle)
CallFunction(ddoc_libno,"dpLabelX",iHandle,@sngX.f)
ProcedureReturn sngX
EndProcedure
Procedure.f dpLabelY(iHandle)
CallFunction(ddoc_libno,"dpLabelY",iHandle,@sngY.f)
ProcedureReturn sngY
EndProcedurehttps://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
-
Noble Bell
- User

- Posts: 34
- Joined: Sun Jun 04, 2006 8:49 pm
- Location: Kentucky, USA
- Contact:




