阅读:1792回复:3
删除打印机deleteport,deletemonitor, deleteprinter,deleteprinterdriver的顺序问题
请问各路大侠:
是不是删除deleteport,deletemonitor, deleteprinter,deleteprinterdriver需要有顺序的删除呢?我原来用的顺序是OpenPrinter->DeletePrinter ->ClosePrinter->DeletePrinterDriver.我要删除port,那要在哪里插入deleteport呢,要删除language monitor需要在哪里插入deletemonitor呢? 我的代码如下,可以删除打印机,可是删除不了monitor,在注册表里还有monitor language项没有删除,郁闷了: if (OpenPrinter(\"D-ROAD Dragon J16 Printer\",&hPrinter,&prtdft)) { if(!DeletePrinter(hPrinter)) { dwErr = GetLastError(); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,NULL,dwErr,NULL,buffer,sizeof(buffer),NULL); MessageBox(buffer); } ClosePrinter(hPrinter); if(!DeletePrinterDriver(NULL,\"Windows NT x86\",\"D-ROAD Dragon J16 Printer\")) { dwErr = GetLastError(); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,NULL,dwErr,NULL,buffer,sizeof(buffer),NULL); MessageBox(buffer); } } if(!DeleteMonitor( NULL, // server name \"Windows NT x86\", // environment name \"DRAGON Language Monitor\" // monitor name )) { dwErr = GetLastError(); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,NULL,dwErr,NULL,buffer,sizeof(buffer),NULL); MessageBox(buffer); }//这里总是说你所指定的语言监视器正在使用!!! 可是我刚安装,什么都没有打印任务。这里如何写!!!????头大了 |
|
|
沙发#
发布于:2004-04-29 14:19
不知道是不是要用
EnumMonitors( NULL, // server name 1, // information level lpMonitors, // monitor information buffer sizeof(lpMonitors), // size of monitor information buffer lpcbNeeded, // bytes received or required lpcReturned // number of monitors received ) 来枚举出所有的语言监视器呀,还是如何?我用这个函数的时候也总是出错说“向占位程序传送了空的指针”?昏!!!!!!!!!!!!!!!!!!!请高手多多指教!! |
|
|
板凳#
发布于:2004-05-05 23:31
删除顺序应该为:
DeletePrinter DeletePrinterDriver DeletePort DeleteMonitor |
|
|
地板#
发布于:2004-05-07 14:11
那添加的时候是不是也要有个顺序呀。象你这么说,那添加时的顺序是不是:
AddMonitor AddPort AddPrinterDriver AddPrinter 我的MSN是davy_yang2163.com 请多多指教 |
|
|