Can anyone translate this to PB?
Works great in C++ (Win9x), but can't get it working in PB.
// AddPrinterDriver.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "windows.h"
#include "winspool.h"
int main(int argc, char* argv[])
{
PRINTER_INFO_2 pi2;
DRIVER_INFO_2 di2;
HANDLE hPrinter;
ZeroMemory(&di2, sizeof(DRIVER_INFO_2));
di2.cVersion = 1024;
di2.pName = "Generic / Text Only";
di2.pEnvironment = "Windows 4.0";
di2.pDriverPath = "c:\\windows\\system\\tty.drv";
di2.pDataFile = "c:\\windows\\system\\tty.drv";
di2.pConfigFile = "c:\\windows\\system\\tty.drv";
AddPrinterDriver(NULL, 2, (LPBYTE)&di2);
ZeroMemory(&pi2, sizeof(PRINTER_INFO_2));
pi2.pPrinterName = "Receipt";
pi2.pPortName = "LPT1:";
pi2.pDriverName = "Generic / Text Only";
pi2.pPrintProcessor = "WinPrint";
pi2.pDatatype = "RAW";
hPrinter = AddPrinter(NULL, 2, (LPBYTE)&pi2);
ClosePrinter(hPrinter);
ZeroMemory(&pi2, sizeof(PRINTER_INFO_2));
pi2.pPrinterName = "License";
pi2.pPortName = "COM1:";
pi2.pDriverName = "Generic / Text Only";
pi2.pPrintProcessor = "WinPrint";
pi2.pDatatype = "RAW";
hPrinter = AddPrinter(NULL, 2, (LPBYTE)&pi2);
ClosePrinter(hPrinter);
return 0;
}
Works great in C++ (Win9x), but can't get it working in PB.
// AddPrinterDriver.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "windows.h"
#include "winspool.h"
int main(int argc, char* argv[])
{
PRINTER_INFO_2 pi2;
DRIVER_INFO_2 di2;
HANDLE hPrinter;
ZeroMemory(&di2, sizeof(DRIVER_INFO_2));
di2.cVersion = 1024;
di2.pName = "Generic / Text Only";
di2.pEnvironment = "Windows 4.0";
di2.pDriverPath = "c:\\windows\\system\\tty.drv";
di2.pDataFile = "c:\\windows\\system\\tty.drv";
di2.pConfigFile = "c:\\windows\\system\\tty.drv";
AddPrinterDriver(NULL, 2, (LPBYTE)&di2);
ZeroMemory(&pi2, sizeof(PRINTER_INFO_2));
pi2.pPrinterName = "Receipt";
pi2.pPortName = "LPT1:";
pi2.pDriverName = "Generic / Text Only";
pi2.pPrintProcessor = "WinPrint";
pi2.pDatatype = "RAW";
hPrinter = AddPrinter(NULL, 2, (LPBYTE)&pi2);
ClosePrinter(hPrinter);
ZeroMemory(&pi2, sizeof(PRINTER_INFO_2));
pi2.pPrinterName = "License";
pi2.pPortName = "COM1:";
pi2.pDriverName = "Generic / Text Only";
pi2.pPrintProcessor = "WinPrint";
pi2.pDatatype = "RAW";
hPrinter = AddPrinter(NULL, 2, (LPBYTE)&pi2);
ClosePrinter(hPrinter);
return 0;
}
Comment