我要对并口打印机发指令,自己写驱动,
  请问各位有什么办法可以在win2000下如何取得并口打印机状态?
如联机、缺纸等。
  谢谢!!

解决方案 »

  1.   

    我试过使用汇编,
     MOV DX,$379; 
     IN AL,DX; 
    但出现
      Privileged instruction
    警告错误。不知还有什么方法?
      

  2.   

    你试试能不能用API
    NT内核是禁止直接访问底层的
      

  3.   

    看一下这个吧:
    The following is an example of opening a printer and writing a raw 
    string of data to the printer. Note that you must send the correct 
    printer name, such as "HP LaserJet 5MP" for the function to succeed.
    You are also responsible for embedding any necessary control codes 
    that the printer may require.uses WinSpool;procedure WriteRawStringToPrinter(PrinterName:String; S:String);
     var
       Handle: THandle;
       N: DWORD;
       DocInfo1: TDocInfo1;
     begin
       if not OpenPrinter(PChar(PrinterName), Handle, nil) then
         begin
          ShowMessage('error ' + IntToStr(GetLastError));
          Exit;
         end;
       with DocInfo1 do begin
         pDocName := PChar('test doc');
         pOutputFile := nil;
         pDataType := 'RAW';   end;
       StartDocPrinter(Handle, 1, @DocInfo1);
       StartPagePrinter(Handle);
       WritePrinter(Handle, PChar(S), Length(S), N);
       EndPagePrinter(Handle);
       EndDocPrinter(Handle);
       ClosePrinter(Handle);
     end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      WriteRawStringToPrinter('HP', 'Test This');
    end;最好是在DOS下采用C/C++直接写程序最好。
      

  4.   

    softwing(向前看) :
      我现在不是不能打印,我是想取得打印机的状态,
    另外,你的程序好像是要安装打印驱动的,我是想
    直接接上计算机就可以发指令了,无需安装驱动。