OpenPrinter fail: Win7, Win8

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

G = openPrinter(Printer)
G.drawPicture PicToPrint
The app stops responding when this code is called and the Windows Event Log shows the following:

Faulting application name: Print Test.exe, version:, time stamp: 0x53da569a
Faulting module name: RBGUIFramework.dll, version:, time stamp: 0x53da561c
Exception code: 0xc0000005
Fault offset: 0x0012f24b
Faulting process id: 0x11f8
Faulting application start time: 0x01d0696798af7a55
Faulting application path: C:\Program Files (x86)\Print Test\Print Test.exe
Faulting module path: C:\Program Files (x86)\Print Test\Print Test Libs\RBGUIFramework.dll
Report Id: 06536f7b-d55b-11e4-be68-2cd444b9785d
Faulting package full name:
Faulting package-relative application ID:

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.

Any insight is welcome!!


Don’t know if this is truly related or not, but if you’re app is restoring saved printer setup settings, it might be.
link text

Hi Don,

Thanks for your reply.

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-

DevModeStructurePS=DS-RX1?Ca{d,,(6x4)????DINU"8t| 8SMTJ(|TFSM????



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.

Hey Bob,

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!

@Don Lyttle Yep, that’s my buddy! She’s been my right hand the last two years with doing the Hour of Code- she’s the queen of IF statements-LOL!

My daughter was the Queen of Why loops.

Because it is important.
Because it will benefit you down the road.
Because it is an important part of growing up.
BECAUSE I SAID SO! <- The phrase I swore would never cross my lips

[quote=177588:@Peter Fargo]Why?
BECAUSE I SAID SO! <- The phrase I swore would never cross my lips
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”. ^^