klaus wrote:Hello tc,
I tested #CgWinPrinterServer class -> #allPrinterScreenInfos with Windows XP, Service Pack 3 and it didn't works too. #CgDisplay class -> #defaultPrinterDisplayName returns also no printer; not with Win2000 nor Win XP. What went wrong?
Some errors are in the V8 code. Exchange the start of the method "CgDisplay>>defaultPrinterDisplayName" with:
defaultPrinterDisplayName
- Code: Select all
rc := OS
getDefaultPrinter: (pszBuffer := OSStringZ new: 256)
pcchBuffer: ((pcchBuffer := OSUInt32 new) uint32At: 0 put: 256 ; yourself ).
....
rc ifFalse: [^nil].
....
The problem with the original code is, that
((pcchBuffer := OSUInt32 new) uint32At: 0 put: pszBuffer size)
returns NOT pcchBuffer, but the result of pszBuffer size - which is 0 and therefore a NULL pointer is given to the API call. pszBuffer size is 0 because the instance of OSStringZ contains an empty string before the API call.
Marten