IonicWind Software

IWBasic => General Questions => Topic started by: ckoehn on March 30, 2010, 09:43:29 AM

Title: Error after printing
Post by: ckoehn on March 30, 2010, 09:43:29 AM
I am receiving a fatal program error after I print to a network printer from my netbook.  I am using ddoc32.dll and I have followed sapero's asm add-in's needed for that dll.  The information I want to print does print and then I receive the error.  I put a messagebox after the place where I call the code to print and it makes it to there OK.  It looks like the error occurs after it leaves the windows message subroutine.  The thing that is annoying is that it runs on my desktop just fine.  Anyone have any ideas what to try?

Thanks,
Clint
Title: Re: Error after printing
Post by: mrainey on March 30, 2010, 12:29:13 PM
QuoteI am using ddoc32.dll and I have followed sapero's asm add-in's needed for that dll.

What add-ins are needed?  I've used ddoc for years with no problems.
Title: Re: Error after printing
Post by: ckoehn on March 30, 2010, 01:25:20 PM
mrainey,

It has to do with dpTextWidth function.  Any dp.. function that returns a single or double precision value doesn't clear the stack properly.  Follow the thread below.

I am beginning to not think it is EBASIC or ddoc, but I don't know for sure.  It could just be my netbook although I have never had that error on there with any other program.

http://www.ionicwind.com/forums/index.php/topic,3909.15.html
Title: Re: Error after printing
Post by: ckoehn on March 30, 2010, 07:53:58 PM
Update.  I was using PRTDIALOG to select a printer and passing that printer to ddoc using dpSpecifyPrinter.  I like PRTDIALOG better, but something caused an Access Violation again. Probably sending it to dpSpecifyPrinter would be my guess, but that returns a long value, not a float or double. The code below shows the changes I had to make.  I don't know why it didn't work and that bugs me.

Clint


'This didn't work.

CONTROLCMD win,RichEdit,@RTGETSELTEXT,sel,79999
IF LEN(sel)=0
MESSAGEBOX win,"No selection made!","Messenger Of Truth 3.0"
ELSE
pStartPage=1
pEndPage=1
pCopies=1
pCollate=0
pPrinter= PRTDIALOG(win,pStartPage,pEndPage,pCopies,pCollate)
IF pPrinter<>""
prtFile=dpStartDoc(0,"Messenger Of Truth 3.0","",DDOC_INCH,DDOC_PAPER_LETTER,DDOC_PORTRAIT,DDOC_SYSTEM_DEFAULT,DDOC_ZOOMFIT)
IF dpSpecifyPrinter(prtFile,pPrinter)=0
MESSAGEBOX null,"Invalid PRINTER","Messenger Of Truth 3.0"
dpEndDoc(prtFile,DDOC_END_DELETE + DDOC_END_CLOSE)
ELSE
PrintSel()
ENDIF
ENDIF
ENDIF

'.........other code
SUB PrintSel()

'....other code

dpPageNo(prtFile,4.25,10,DDOC_CENTER,0)
dpEndDoc(prtFile,DDOC_END_SPECIFIC_PRINTER+DDOC_END_DELETE)
ENDSUB


'This worked

CONTROLCMD win,RichEdit,@RTGETSELTEXT,sel,79999
IF LEN(sel)=0
MESSAGEBOX win,"No selection made!","Messenger Of Truth 3.0"
ELSE
PrintSel()
ENDIF

'.........other code
SUB PrintSel()
prtFile=dpStartDoc(0,"Messenger Of Truth".0","",DDOC_INCH,DDOC_PAPER_LETTER,DDOC_PORTRAIT,DDOC_SYSTEM_DEFAULT,DDOC_ZOOMFIT)

'....other code

dpPageNo(prtFile,4.25,10,DDOC_CENTER,0)
dpEndDoc(prtFile,DDOC_END_PRINT+DDOC_END_DELETE)
ENDSUB
Title: Re: Error after printing
Post by: ckoehn on April 03, 2010, 12:49:05 PM
The one thing I learned is to make sure all supporting files are installed and registered on the computer that will be running ddoc.  DDOC.EXE, DDOC16.DLL, DDOC32.DLL, and DDOC_JPG.DLL.  I think that that was what was causing all of my problems.  I will probably in the near future paste the original code back in and see if I am right.

Later,
Clint