Un-threading my Threads!

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

I have a thread in my application that is listening to the Serial port using GetCommEvents.
When something is received, it generates an event, and then goes back to waiting for more data. - I am using this for a swipe card reader.


When a card is swiped, an event is generated, and I log the user into my application. The card reader is no longer required at this point so I disable it, which kills off the thread.
Now - because the card reader thread generated the event, my entire application seems to be using that thread, and so as soon as the thread gets killed, all my windows disappear, and the main thread is left running in the background with nothing to do.


I have tried creating a new thread in the event handler, so that when the first thread is stopped it would then keep running on the new one - but that one seems to get stopped as well with the same results, even though it is declared globally etc.

Can anybody tell me what I need to do to get around this problem, as I'm sure it's a fairly common problem, but I'm pretty new to multi-threading and it's giving me a headache!


Thankyou in advance.

Paul Cheetham
.



Relevant Pages

  • Re: electronic id card reader visual basic
    ... This is completely controlled by the card reader. ... If the connection is by serial port, then you would use System.IO.Ports.SerialPort, and the documentation from the card reader manufacturer to decode the actual data received. ... However, it is possible that the device uses a HID USB connection, and then you would have to wrap the USB APIs. ...
    (microsoft.public.dotnet.general)
  • Re: Un-threading my Threads!
    ... you can do something similar and execute a ... delegate on the main form from your thread. ... The card reader is no longer required at this point so I ... > sure it's a fairly common problem, but I'm pretty new to multi-threading ...
    (microsoft.public.dotnet.languages.vb)
  • Re: HC SD card queries
    ... Card Reader on my old XP SP1 PC, which I assumed was because that PC ... didn't have USB 2.0.So I bought a little USB adapter and that allowed ... years wouldn't read the SDHC. ... Is this a common problem please? ...
    (rec.photo.digital)
  • display output from serial port device
    ... i use the following code to connect to HA3035 proximity access controller ... card reader through serial port. ... devide is in some strange character. ...
    (comp.os.linux.development.system)
  • Re: connect Canon Coolpix 800 to PC (found)
    ... Coolpix 800. ... It indicates that we are talking serial port. ... My ThinkPad R40 has no serial port. ... the card reader should last for many, ...
    (alt.photography)