StartDocPrinter(hPrinter, 1, di) returns false

大城市里の小女人 提交于 2019-12-13 04:36:46

问题


i am trying to print a raw data to the printer. i got my codes from http://support.microsoft.com/kb/322090

in the code segment...

   Dim di As New DOCINFOW


    With di

        .pDocName = "My Visual Basic .NET RAW Document"        
        .pDataType = "TEXT"
        .pOutputFile = vbNull
    End With

 If OpenPrinter(szPrinterName.Normalize(), hPrinter, IntPtr.Zero) Then
        If StartDocPrinter(hPrinter, 1, di) Then
            If StartPagePrinter(hPrinter) Then
                bSuccess = WritePrinter(hPrinter, pBytes, dwCount, dwWritten)
                EndPagePrinter(hPrinter)
            End If
            EndDocPrinter(hPrinter)
        End If
        ClosePrinter(hPrinter)
    End If

the first if returns TRUE but the If StartDocPrinter(hPrinter, 1, di) Then returns FALSE that's why further nested if cannot be catered. I have worked in this problem for hours searching, etc to no avail. Anybody who happened to encounter the same problem may have a solution. Thank you.

来源:https://stackoverflow.com/questions/16189135/startdocprinterhprinter-1-di-returns-false

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!