clear #define DC_PAPERNAMES 16 #define DC_PAPERS 2 #define ZEROS(n) replicate(chr(0), n) parameters cDevice initExterns() if not type("argVector(1)") == "C" cDevice := getPrinterDefault() endif ?cDevice local a, i a = getPapers( cDevice, "") return function getPapers(cDevice, cPort) local aRet, cName, i, ii, lpDevMode, nPair, nWord,; sPaperName, sPaperSize lpDevMode = 0 // get the number of paperSize/paperName pairs. nPair = RMM_DeviceCapability(; cDevice,; cPort,; DC_PAPERS,; null,; lpDevMode) if nPair > 0 sPaperName = ZEROS(nPair * 64) // fill the paperName buffer. RMM_DeviceCapability(; cDevice,; cPort,; DC_PAPERNAMES,; sPaperName,; lpDevMode) for n = (nPair-3)*64 to len(sPaperName) ? iif(n%64 = 0,'',' ') ??iif(sPaperName.getByte(n) <> 0, chr(sPaperName.getByte(n)),'0') next endif return //------------------------------------------------------------// // return the windows default printer as a string. function getPrinterDefault Local sBuff, cRet, nLen sBuff = ZEROS(250) nLen = RMM_GetWinIniString( ; "windows", "device", ; ",,,", sBuff, sBuff.length) cRet = sBuff.left(sBuff.indexOf(",")) return cRet.rightTrim() //------------------------------------------------------------// // return a WORD from the string sValu starting at nByte. function getWord(sValu, nByte) return int(sValu.getByte(nByte) + ; bitlshift(sValu.getByte(nByte + 1), 8)) //------------------------------------------------------------// function initExterns if not type("RMM_DeviceCapability") == "FP" extern CINT RMM_DeviceCapability( ; CSTRING, CSTRING, CWORD, CPTR, CPTR); winspool.drv from 'DeviceCapabilitiesA' endif if not type("RMM_GetWinIniString") == "FP" extern CULONG RMM_GetWinIniString( ; CSTRING, CSTRING, CSTRING, CSTRING, CULONG); kernel32 from "GetProfileStringA" endif return