IonicWind Software

IWBasic => General Questions => Topic started by: LarryMc on April 21, 2012, 11:17:31 AM

Title: Print Dialog problem
Post by: LarryMc on April 21, 2012, 11:17:31 AM
I need some help.
When I try to use a network printer with the following program the PRTDIALOG command goes off into never-never land.
If I use a local printer it works fine

But, if I use the print functions in the current IDE or the new IDE the network printer works fine.

I need someone who has a network printer AND the latest version of IWBasic 2.x to try it and let me know if they have the same problem.

DEF hPrt:UINT
DEF prtdata:STRING
DEF name:STRING
DEF pagefrom,pageto,copies,collate:INT
pagefrom = 1
pageto = 1
copies = 1
name = PRTDIALOG(NULL,pagefrom,pageto,copies,collate)
hPrt = OPENPRINTER(name,"Test Document","TEXT")
IF (hPrt)
   prtdata = "This is a test of printing"
   prtdata = prtdata + chr$(13)
   prtdata = prtdata + "This is line 2"
   WRITEPRINTER hPrt,prtdata
   CLOSEPRINTER hPrt
ENDIF
END


Thanks,

LarryMc
Title: Re: Print Dialog problem
Post by: LarryMc on April 21, 2012, 11:40:22 AM
Found the problem.
I looked at the source code for the PRTDIALOG command.
It returns a string, which is the name of the printer.
Currently it is defined as a 32 character ISTRING.
The path/name for my network printer is more than 32 characters.

LarryS will have to up the size in the routine and update the library.

LarryMc
Title: Re: Print Dialog problem
Post by: Brian on April 21, 2012, 01:38:36 PM
Larry,

You know, I've had those kind of problems before, with stuff I have written at
home, and then used at work, on network printers. Never thought the problem
would be string space!

Well done!

Brian
Title: Re: Print Dialog problem
Post by: ckoehn on March 27, 2018, 10:05:12 AM
I know this is an old thread, but has this problem been fixed?  I'm still having this problem.

Later,
Clint
Title: Re: Print Dialog problem
Post by: LarryMc on March 27, 2018, 05:11:36 PM
No, it hasn't been fixed as far as I know.
Can you check and tell me the full length of your network printer including the full path?

I'll see if I can fix it and put out an update

LarryMc
Title: Re: Print Dialog problem
Post by: ckoehn on March 27, 2018, 06:31:27 PM
Busy tonight. Will try to get it tomorrow.

Later,
Clint
Title: Re: Print Dialog problem
Post by: ckoehn on March 27, 2018, 06:41:37 PM
Just quit what I was doing and got to it.  I think 37 characters.  It is a network printer. Should a person allow 254 for future changes?  Regular string length.

Later,
Clint
Title: Re: Print Dialog problem
Post by: Rock Ridge Farm (Larry) on March 28, 2018, 05:28:16 PM
I will look at the old code and see what I can do when I get some free time.
I wrote a long winded answer to this and fat fingered it and it ended up deleted.
The short version:
Working on the new version of the compiler.
It is written using clang/llvm and builds an AST so that output can be compiled for many target Operating Systems.
If you want to help with the new compiler - it started from summus https://github.com/igor84/summus.
Review it and if you understand it - I can use the help.

Larry
Title: Re: Print Dialog problem
Post by: LarryMc on March 28, 2018, 09:12:28 PM
LarryS
I can  take care of this if you will put the latest source files (*.iwb) used to build iwbstd.lib in a folder where I can get to them FileZilla. I can make the change to the PRTDIALOG file; recompile and rebuild the lib file and then issue a new update to the installer.

LarryMc
Title: Re: Print Dialog problem
Post by: LarryMc on March 29, 2018, 08:26:06 AM
Clint (and anyone else who is experiencing this problem)
I need you to test this for me.

Unzip the the attachment.

add the prtdialog255.iwb source file to your project.
where your are currently calling PRTDIALOG change it to PRTDIALOG255

compile your project

let me know what happens

LarryMc
Title: Re: Print Dialog problem
Post by: ckoehn on March 31, 2018, 02:00:12 PM
Just tried it out.  It fixed the error I was encountering.  Haven't given it a real run for the money but looks like it will work.

Thanks,
Clint
Title: Re: Print Dialog problem
Post by: ckoehn on April 02, 2018, 06:56:38 AM
Larry,

Does GETDEFAULTPRINTER have the same issue?

Later,
Clint
Title: Re: Print Dialog problem
Post by: LarryMc on April 02, 2018, 09:24:14 AM
Quote from: ckoehn on April 02, 2018, 06:56:38 AM
Larry,

Does GETDEFAULTPRINTER have the same issue?

Later,
Clint

As a matter of fact it does.
Clint (and anyone else who can)
I need you to test this for me.

Unzip the the attachment.

add the GETDEFAULTPRINTER255.iwb source file to your project.
where your are currently calling GETDEFAULTPRINTER change it to GETDEFAULTPRINTER255

compile your project

let me know what happens

I REALLY need these two functions tested where there are MORE than 1 printers available with names longer than 32 characters available to really prove they work.


LarryMc
Title: Re: Print Dialog problem
Post by: ckoehn on April 02, 2018, 01:09:11 PM
It looks like it works.  This works too. :)

sub GETDEFAULTPRINTER255(), STRING   
   string printname
   word psize=254
   
   psize=GetDefaultPrinterA(printname,&psize)
      
   return printname
endsub