Unless you prevent your App from losing focus when the bar code scanner is attached, which would require the user to disconnect it to use the PC for anything else, another program could still be given the focus.

An alternative that might work, if the bar code scanner you are using has the capability, is to assign a prefix code that the scanner sends before each data scan. Most recent scanners have this capability - check the manual for yours. You could program your App to watch for this prefix code, and make sure it has the focus and moves the cursor to the appropriate field. Your App would probably have to make sure to capture all input to look for the prefix code, and pass on data not intended for it.