错误System.Runtime.InteropServices.COMException

时间:2014-03-03 03:31:42

标签: visual-studio

我正在制作一个项目的问题  它是从wacom获取签名的程序  标志垫它在第一次运行时工作正常,然后  我尝试为第二个输入另一个签名  它得到这个错误信息的时间

以下是代码:

   Dim sigCtl As New SigCtl
    Dim dc As New DynamicCapture
    Dim res As DynamicCaptureResult
    sigCtl.Licence = "AgAZAPZTkH0EBVdhY29tClNESyBTYW1wbGUBAoECA2UA"
    res = dc.Capture(sigCtl, "who", "why", vbNull, vbNull)
    If (res = DynamicCaptureResult.DynCaptOK) Then
        print("signature captured successfully")
        Dim sigObj As SigObj
        sigObj = sigCtl.Signature
        sigObj.ExtraData("AdditionalData") = "VB test: Additional data"
        Dim filename As New String("sig1.png")

sigObj.RenderBitmap(filename,200,150,“image / png”,0.5F,& HFF0000,& HFFFFFF,-1.0F,-1.0F,_             RBFlags.RenderOutputFilename或RBFlags.RenderColor32BPP或RBFlags.RenderEncodeData)

        sigImage.Load(filename)
    Else
        print("Signature capture error res=" & res)
        Select Case res
            Case DynamicCaptureResult.DynCaptCancel
                print("signature cancelled")
            Case DynamicCaptureResult.DynCaptError
                print("no capture service available")
            Case DynamicCaptureResult.DynCaptPadError
                print("signing device error")
            Case Else
                print("Unexpected error code ")
        End Select
    End If

错误发生在sigobj.rederbitmap语法周围,它给出了System.Runtime.InteropServices.COMException异常

我有点困惑,因为它总是在第一次尝试时才会出错

提前致谢* 强文 *

1 个答案:

答案 0 :(得分:0)

我在wacom STU-530设备上遇到了同样的问题。 对我来说有用的是每次用户想要使用另一个测试时更改文件名字符串。

Dim rndm As New Random
Dim serial As Integer = rndm.Next(1, 9999)
Dim str_serial As String = CStr(serial)
Dim filename As New String("sig_" & str_serial.PadLeft(4, "0") & ".png")