Thanks for the reply guys
@Richard: I'm not using any ini at the moment.
@James: Oops, sorry I missed your Oct 6th's post. The hDC is 0 only in my module James. It definitely isn't 0 when running samples\testprn2.prg. I even compile and linked in libs as per how I do with my problematic module yet testprn2.prg still runs with no problem. So it seems likely that something within my code is causing this problem but I'm not certain how to go from here. I mean at the top of the module, I inserted these 3 lines, just to see what I would get:
- Code: Select all Expand view
? GetDefaultPrinter()
Printersetup()
? ud_prngetname()
...
function ud_PrnGetName()
local cret, oprn
PRINTER oPrn
cRet := oPrn:getmodel()
endprint
return cret
The results,
GetDefaultPrinter() - a function in xHarbour pointed to me by Stefan, works with no error and returns the default printer name
Printersetup() - nothing happens at all
UD_PrnGetName() - a function I written myself a while back when I didn't know of GetDefaultPrinter() existence. This one would cause the message "There are no printers installed! Please exit this application and install a printer" to appear. Clicking Ok after that message would yield "The instruction at 0x0041995d referenced memory at 0x00000002. The memory could not be read. Click on Ok to terminate the program."
Now to further confuse the matter, I did some of the printout using Fastreport and so far it can always do a preview with no problem whatsoever.
Hey, is it possible this happens because the PC is moody? Wonder whether my boss would accept that excuse
@Randal: I have 3rd party libraries and dll's but not that many. One is SoftwareKey for copy protection while the other is Fastreport. Thanks for your idea Randal, it's something that has never crossed my mind. I'll give it a shot.
What bugs me about this whole thing is UAC has been completely turned off and user account is already of administrator type and yet it still display symptoms of inadequate permission.