April 26, 2024, 12:00:47 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Print Dialog problem

Started by LarryMc, April 21, 2012, 11:17:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

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

ckoehn

I know this is an old thread, but has this problem been fixed?  I'm still having this problem.

Later,
Clint

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ckoehn

Busy tonight. Will try to get it tomorrow.

Later,
Clint

ckoehn

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

Rock Ridge Farm (Larry)

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

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ckoehn

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

ckoehn

Larry,

Does GETDEFAULTPRINTER have the same issue?

Later,
Clint

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ckoehn

It looks like it works.  This works too. :)

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