lnRetry = 0 DO WHILE lnRetry < 10 lnRetVal = THISFORM.oleStar.ClaimDevice(100) IF lnRetVal = 0 EXIT ENDIF lnRetry = lnRetry + 1 ENDDOMy other code revision is at the end of your code below. I do not see a problem with the rest of the code. Since I use Epson printers, there could be a problem with what Star is providing to you or it could be my lack of familiarity with the Star printers and what they are providing with their control.
> #DEFINE PRTNAME [TSP442D] > IF THISFORM.olestar.Open(PRTNAME) = 0 > IF THISFORM.olestar.ClaimDevice(0) = 0 > THISFORM.olestar.DeviceEnabled = .T. > THISFORM.olestar.AsyncMode = .F. > Messagebox("Printer enabled") > IF THISFORM.oleStar.CapRecNearEndSensor = .F. > Messagebox("Printer don't have near end sensor") > ELSE > Messagebox("Printer have near end sensor") > IF THISFORM.oleStar.RecNearEnd > Messagebox("Printer receipt paper is low") > ENDIF > ENDIF > IF THISFORM.olestar.CapRecEmptySensor > IF THISFORM.olestar.RecEmpty > Messagebox("Paper is empty") > ELSE > Messagebox("Paper is okay") > ENDIF > ELSE > Messagebox("Printer don't have empty sensor") > ENDIF > ENDIF > IF THISFORM.oleStar.Claimed *!* I do not do this. I just close the device. *!* THISFORM.oleStar.ReleaseDevice() *!* Messagebox("going to close the device") > THISFORM.olestar.Close() > Messagebox("All done") > ENDIF > ENDIF