Release Pos printer while catch PosControlException

Blocat Release Pos printer while catch PosControlException

  • 26 februarie 2012 06:59
     
      Are cod

    Dear All,

             Please have a look at the following code. Can I release the printer while PosControlException occurs? What will happen if I do that?

    Dim posExplorer As New PosExplorer()
    Dim deviceInfo As DeviceInfo = Nothing
    deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, PrinterName)
    pr = posExplorer.CreateInstance(deviceInfo)   
    pr.Open()
    Try   
    	pr.Claim(10000)
    Catch e As PosControlException
    	Try
    		pr.Release()
    	Catch ex As Exception
    		Throw e
    	End Try
    	Throw e
    Catch e As Exception
    ....
    End Try
    Thanks

Toate mesajele

  • 26 februarie 2012 17:31
    Membru care oferă răspunsuri
     
     

    If you get an error on a claim in the service object, I would guess the device was never claimed, thus release is redundant. It can't hurt.

    -Sean


    www.sjjmicro.com / www.seanliming.com / www.annabooks.com, Book Author - Pro Guide to WES 7, XP Embedded Advanced, Pro Guide to POS for .NET

  • 27 februarie 2012 01:59
     
     

    Hi, Sean Liming,

      Sometimes, I got an exception message:The port is already open. Why will I see the message? Could you tell me the reason?

  • 27 februarie 2012 05:26
    Membru care oferă răspunsuri
     
     

    On which error message? Claim or Release?

    -Sean


    www.sjjmicro.com / www.seanliming.com / www.annabooks.com, Book Author - Pro Guide to WES 7, XP Embedded Advanced, Pro Guide to POS for .NET


  • 27 februarie 2012 08:36
     
     

    On which error message? Claim or Release?

    -Sean


    www.sjjmicro.com / www.seanliming.com / www.annabooks.com, Book Author - Pro Guide to WES 7, XP Embedded Advanced, Pro Guide to POS for .NET



    Claim, thanks