Timeout on a .net assembly load

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Hi All

I have a POS program (Windows app) . I am using VB.net 2005 Pro

The OPOS drivers freezes my program if Parallel port is configured for the
Receipt printer and the Printer is not connected or is turned off
The freezing happens when I try to Claim the device e.g

I am using a .net assembly OPOSPOSPrinter.dll

mypos = new OPOSPOSPrinter
mypos.open(Printername)
mypos.claim(300) ***** Happens here if the driver cannot communicate with
the Printer
mypos.enabled = True

There is no connection timeout on the Parallel printer driver for some
strange reason and the POS program has to be crashed.
Serial and USB versions of the Driver timeout OK


Is there anyway to configure a timeout on the code above
in vb, to kill the driver after say 3 seconds, if the
printer is not responding, so my program can continue to load.?

Regards
Steve
 
Hi All

I have a POS program (Windows app) . I am using VB.net 2005 Pro

The OPOS drivers freezes my program if Parallel port is configured for the
Receipt printer and the Printer is not connected or is turned off
The freezing happens when I try to Claim the device e.g

I am using a .net assembly OPOSPOSPrinter.dll

mypos = new OPOSPOSPrinter
mypos.open(Printername)
mypos.claim(300) ***** Happens here if the driver cannot communicate with
the Printer
mypos.enabled = True

There is no connection timeout on the Parallel printer driver for some
strange reason and the POS program has to be crashed.
Serial and USB versions of the Driver timeout OK

Is there anyway to configure a timeout on the code above
in vb, to kill the driver after say 3 seconds, if the
printer is not responding, so my program can continue to load.?


Does it ever return? Could you move that code off into another thread
so the rest of your app is not frozen?

Chris
 
Hi Chris

I never returns, so your idea is a good one

Running the code in a thread would lock the thread. How could I then force
the thread to terminate?

Regards
Steve
 
Back
Top