OK, this seems to fix it.
Change
Zed Gecko wrote:
Code:
sizeDevMode := DllCall("Winspool.drv\DocumentProperties", "Ptr", MainhWnd, "Ptr", pPrinter, "StrP", pPrinterName, "Ptr", &pDevModeOutput, "Ptr", &pDevModeInput, "UInt", 0)
VarSetCapacity(pDevModeOutput , sizeDevMode, 0)
out2 := DllCall("Winspool.drv\DocumentProperties", "Ptr", MainhWnd, "Ptr", pPrinter, "StrP", pPrinterName, "Ptr", &pDevModeOutput, "Ptr", &pDevModeInput, "UInt", 2)
to
Code:
sizeDevMode := DllCall("Winspool.drv\DocumentProperties", "Ptr", MainhWnd, "Ptr", pPrinter, "Ptr", pPrinterName, "Ptr", &pDevModeOutput, "Ptr", &pDevModeInput, "UInt", 0, int)
; VarSetCapacity(pDevModeOutput , sizeDevMode, 0)
VarSetCapacity(pDevModeOutput , A_PtrSize, 0)
; outputdebug, % "sizeDevMode: " sizeDevMode
out2 := DllCall("Winspool.drv\DocumentProperties", "Ptr", MainhWnd, "Ptr", pPrinter, "Ptr", pPrinterName, "Ptr", &pDevModeOutput, "Ptr", &pDevModeInput, "UInt", 2, int)
Why did you use StrP for the third parameter of DocumentProperties? Msdn says
msdn DocumentProperties wrote:
pDeviceName [in]
A pointer to a null-terminated string that specifies the name of the device for which the printer-configuration property sheet is displayed.
So it should be ptr.
Anyway congrats, the script run with the 64bit build printed out a red circle. The library seems to be very nice.
I have a question, is this library able to print out a text file and save it as a specified image format? Let's say, I want to create a print view of FileA.txt and save it as FileA.jpg.