帮我看看这段代码,怎么有问题:
用AdvancedDocumentProperties设不回参数;
用注释掉的那段DocumentProperties,按确定之后就会报错。
请高手帮忙解决,或者帮忙顶一下,谢谢了。
void __fastcall TForm1::btnDocumentPropertiesClick(TObject *Sender)
{
HANDLE hPrinter;
String pn = Printer()->Printers->Strings[Printer()->PrinterIndex];
PRINTER_DEFAULTS pd;
int Size;
PDEVMODE DevMode;
ZeroMemory(&pd, sizeof(pd));
pd.DesiredAccess = PRINTER_ALL_ACCESS;
if (OpenPrinter(pn.c_str(), &hPrinter, &pd))
{
Size =do
cumentProperties(Handle,
hPrinter,
pn.c_str(),
DevMode,
DevMode,
0);
if (Size > 0) {
DevMode = (PDEVMODE)malloc(Size);
do
cumentProperties(Handle,
hPrinter,
pn.c_str(),
DevMode,
DevMode,
DM_OUT_BUFFER);
AdvancedDocumentProperties(Handle,
hPrinter,
pn.c_str(),
DevMode,
DevMode);
//DocumentProperties(Handle,
// hPrinter,
// pn.c_str(),
// DevMode,
// DevMode,
// DM_PROMPT);
free(DevMode);
}
ClosePrinter(hPrinter);
}
}