-
Process Help
Hi,
I have written a program in C that opens Com Port 1 and sends characters to an LCD screen it can also read in packet responses from the LCD screen. But if I press a button on the LCD device I need my program to acknowledge the buuton press on myWinXp machine.
Do I need to rcreate a process/thread to wait/listen for a button press?
At the moment I am using ReadFile() to read in packet responses from the LCD screen and this works for most LCD commands(Reboot, ClearScreen etc.)
Does anyone have any suggestions?
Can anyone suggest any books or tutorials to get to learn about programming windows processes in C?
Thanks
-
To start from the end:
Amazon.com: Programming Windows®, Fifth Edition (Microsoft Programming Series): Charles Petzold: Books
would be the best choice in my opinion - it's a bit old, but 99% of the API's used then are still available in Vista, and more in XP. Process management is certainly very much the same in all editions of Windows from NT 3.5 onwards.
I don't think you actually need another process - just separate your "listener" and "sender" processes into their own threads, and let the a third thread manage what you do - e.g. send a message, receive a button press, etc. It's not entirely trivial, but it won't be any easier with multiple processes.
--
Mats
-
You can use the kernel's thread objects and functions but you really don't have to as long as your system is constantly updating and listening to the screen. Once the screen does receive a press or touch then you can use the observer/listener pattern and notify all interested parties of the event so they can respond to it.
It is a good candidate for threading but the observer/listener could also be used in a threaded approach.