Triggering Powershell Program on barcode scan event windows 10 - windows

I am looking for using barcode capture event to executing a program (either powershell or simple vbscript) on Windows 10 machine. How can I achieve that? Do I need to create a barcode program embedded in it - if yes, how will it execute? Do I need to capture the scan event in windows machine and write a logic on scan event to execute program - is that possible?
I am not finding any help on internet. Please help.

There is no mechanism that can be called by simply registering an event handler.
Based on the mode and mechanism of the scanner device you are using, you need to create an application program that handles it.
Hardware type and mode
Keyboard input emulation
Serial (or Bluetooth) port connection
Camera image recognition
programming
The application handles the device directly
Libraries and APIs
OPOS
POS for.NET
Windows.Devices.PorintOfService
JavaPOS
Various libraries that recognize barcodes from cameras/images
At a minimum, you need to open the device or register a keystroke event handler.
In addition, it will be necessary to send a command to start/stop scanning of the scanner, to distinguish between human-operated keyboard input and notification from the scanner.
It's not impossible to implement them in PowerShell, but it's likely to be difficult and slow.

Related

How to Enable/Disable a Device in Device Manager in Windows through its API?

I started learning AutoHotKey and wanted to know if it was possible to write a script that allows me to enable/disable a device in device manager without having to manually unplug/plug the device from the computer. I wasn't sure if I needed to run the script on the command line and somehow access the API of the Device Manager through there and write one/two lines of code that allows to enable/disable. I did stumble across the API: DeviceIoControl. I think I can get the handle of the device by using the CreateFile function that has the name of the device. The problem is I'm not sure how to properly use the name of the device in order to enable/disable it.

Debugging stm32f4 via bluetooth

I'm rather unexperienced on the field of microcontrollers, I come from a Java background so the question might seem a bit noob but I didn't find much information on this.
So is it possible to debug an STM32F4 board via bluetooth (using eclipse or some othe IDE)? And if so could you send me some links that might help? We're building a robotic car controlled by a discovery board and debugging using an USB cable is not really an option if we don't want to disassemble the whole stuff every time something goes wrong. Hence this would really come in handy. So any help is appreciated
For doing this you would need to find a "Bluetooth Enabled" Debugger. I have never seen any and not sure whether there exists such thing or not.
I would suggest you one thing:
Assuming you have bluetooth connectivity between your board and your Machine,
Insert Debug strings: Send some strings from your board to your PC via Bluetooth. These strings will give you what's going on in Circuit.
For example, After Initialization, send "Init Completed" and like that. You can see these strings and see what's wrong.
I usually do this for my Wireless Device.
What you're wanting to do is really not practical; you're coming at this from way too high a level and trying to imagine the system as if it were running an operating system from the word go.
When you get the STM32 it as empty shell; you need to program it to do what you need to do and the only [sensible] way to get register-level debugging is to use a JTAG interface.
If, and this is a big if, you get it working reliably, but just want to give some debug information back while it is running, you could write a load of routines within the code to send out debugging messages when it enters certain parts of the program - and send it out over Bluetooth - but this is nothing like what you're used to single stepping through your Java code with Eclipse. If you want to do that kind of thing, you are going to have to put a little connector on that allows you to connect your JTAG or two-wire debugger cable to the processor. Even then, when you do that, you will be completely resetting your program and not simply single stepping through from where it went wrong.
You could insert a monitor program within your program to send out register values, program status etc over Bluetooth, but you still have to write the inital code and the only way to do this with out a ridiculous amount of trail and error is via your JTAG or two-wire interface.
Would this product work? It's a "IOGEAR Bluetooth Serial Adapter, GBC232A" for connecting to a serial port over bluetooth. I'm interested in wireless debugging too because my surface-clone dev computer only has one usb and this seems like it could be convenient over a tangle of usb cords and a usb hub. I have zero experience with any of this, so maybe you could validate or invalidate it as an option. I figure it just needs a proper serial connector wired up on the board and power from on-board?

Writing a virtual printer driver for windows

I am new to windows development and I am trying to write a user-mode windows(XP, Vista & 7) virtual printer driver. My aim is to intercept the output being sent to the hardware printer by a third party app and add some extra data(text + graphics) to that output towards the end of the output. Then send the final payload to be printed by the hardware printer. Note that my data would not be added to every print out from the machine but just from a particular third party app.
I want to add my extra data to the print output before it gets converted to any Page Description Language(PDL). Can I do this? Would I be able to predictably add my extra data at the end of the output with proper formatting? If yes, then what kind of driver would I need to write and at what layer of the architecture ?
Is there a better way to do the same thing then writing a user-mode printer driver?
Finally, is there a sample code, online blog or book which can help me with this ?
I think you'd be better off getting the application to write to a generic Postscript driver and post-processing the resulting Postscript rather than trying to make sense of the data written to a printer driver; there are excellent open-source tools available for manipulating Postscript.
This page describes setting up a driver on Windows that will produce Postscript although you will want to do something else with the Postscript other than sending it to another printer as described there.
I don't think you need a driver. Just use the standard Postscript driver provided with the WDK, adding .PPD and .INF files to name it and specify characteristics, and then put your code in a port monitor. Port monitors are considerably easier to build and maintain than print drivers.

How to detect opened sockets in Windows?

In Windows XP (SP2 if necessary), is there any way to detect, from a userspace application, that a TCP/UDP socket (from any process) has opened? I know of the GetExtendedTcpTable() and GetExtendedUdpTable() functions, but they only detect currently opened sockets. Some sockets close immediately after they're opened that the only way I'd be able to detect their existence is by being notified when they open.
If no such a mechanism exists in userspace, I'm willing to go into kernel space to get this functionality. Are there any documented/undocumented features that could do this?
You will likely need to write a WinSock LSP or SPI driver in order to detect that without having to hook every running process directly.

How can we receive a volume attaching notification

When a volume is attached to file system, on Windows,
the Window explorer detects the volume and refreshes automatically.
I wonder the technique.
How do an program(include device driver) get the notification?
-Of course, it doesn’t mean a polling. I want to get an event(or a message).
I would like to get the notification when a network volume(like SMB) is attached.
Thanks in advance.
You're going to have to do some research, but basically you just need to register with the Windows IO Manager so that when the device is connected, some part of your code is called. RegisterDeviceNotification() is probably a good place to get started. When the device is connected, the IO Manager will send you a message, so you should make sure you have a proper callback setup for the message.
It would not hurt to read up on Windows Devices Services from the Windows System API. Depending on what you are doing, you may or may not need a driver as the generic driver provided by Microsoft is often good enough. For drivers, check out the Windows Driver Kit, it contains an excellent collection of sample drivers, as well as Win32 code for interfacing with drivers and working with hardware.
Good luck!

Resources