Renato Parreira
Renato Parreira

Reputation: 858

Application running in background and still be active?

I have a Windows Form Application that reads a barcode from a Web Cam.

Everything is running smooth but I still need to implement a function to the application to keep listening my keyboard inputs and be able to read the barcodes and put the reading in the clipboard.

In other words, do the stuff that my program has to do but in the background.

I searched a lot in the internet but I couldn't find any good answer to my problem.

Can you guys help me?

Thank you a lot!

Upvotes: 0

Views: 232

Answers (2)

Steven Evers
Steven Evers

Reputation: 17196

There's more than one way to perform this.

So the problem is that your application doesn't have focus, and so doesn't get keyboard/mouse input passed to it. To work around that you can use Keyboard hooks.

Alternatively, you can perform polling. That is, run your 'scan' periodically - quickly enough that the user doesn't need to enter keyboard input, they just put something in front of the web cam for a second, and it scans.

Upvotes: 2

Pirion
Pirion

Reputation: 519

You need to use a background worker to read the barcode so the main thread is not locked up. Below is a microsoft example:

http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx

Upvotes: -1

Related Questions