Hi All,
I’ve run into a problem that I haven’t seen elsewhere, only on two of my client’s systems (Windows 7, Windows 8). I’m attempting to print without a dialog using the code below:
//
Sub PrintTheImage(PicToPrint as Picture, PrinterSetupSettings as String)
Dim Printer as PrinterSetup
Dim G as Graphics
Printer.SetupString=PrinterSetupSettings
G = openPrinter(Printer)
G.drawPicture PicToPrint
//
The app stops responding when this code is called and the Windows Event Log shows the following:
The code works on all of my test systems, XP through Windows 8.1 and works elsewhere, which has me puzzled. Why this particular client and why on both his Win7 and Win8 systems?
I’ve also tried building with both RS 2012 R2.1 and Xojo 2014 R2.1, same results.
I am calling for a Printer Setup Dialog earlier on, saving the printer setup string for recall.
As for saving, I Base64 the setup string before dumping it to an SQLite dbase. The string recall seems to be fine, though- everything comes back in-tact.
I did notice that the system with this issue is running a version of Windows 8 that hasn’t been activated yet (saw the activation notice when I signed in remotely). Outside of that, the only other difference I can see is the language. This hasn’t been an issue in the past, though.
I owe you thanks, Don. Your post led me to take a closer look and compare printer setting strings from one of my systems with theirs. I have the same printer in question, so it made things a bit easier.
I noticed that one of the entries seemed quite a bit shorter than mine-
Theirs:
Replacing their entry with mine has stopped the crash and the printer works fine. My question is if anyone uses encoding when capturing the Printer Setup String. I use encoding when capturing user input (textfield, textarea) but haven’t for anything like this…yet.
What I do if I’m saving PrinterSettings is encodebase64 it. Then use DecodeBase64 after reading it back. That way you won’ have to worry about encodings. These strings are really binary strings and should probably be MemoryBlocks.
Yep- that’s what I’ve been doing, especially since I’m writing to SQLite- it has kept things tidy up until this point. right now, I capture the string, Base64 the string, then save to SQLite.
Before you Base64, are you going from binary to string, something like:
Dim StringResult as String
StringResult=Bis.Read(Bis.Length)
BTW … Seeing your gravatar pic put a smile in my heart that’ll last the whole day (and then some) … That’s the definition of “precious” … it’s me who owes you the thanks!
Why?
Because it is important.
Why?
Because it will benefit you down the road.
Why?
Because it is an important part of growing up.
Why?
BECAUSE I SAID SO! <- The phrase I swore would never cross my lips
Why?
[quote=177588:@Peter Fargo]Why?
BECAUSE I SAID SO! <- The phrase I swore would never cross my lips
Why?[/quote]
Ahhh, Peter, how I have lived through that part … both with kids and now grandkids. ^^
But in all those years and experience, I did come up with one answer that effectively ends the seemingly unlimited train of “Whys”. When I reach the point where I’m ready to say, “Because I said so”, instead I answer the “Why” with “to make you ask questions … and see, it’s working really well!” That seems to befuddle them long enough that they lose interest in the “game”. ^^