Process Help

This is a discussion on Process Help within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I have written a program in C that opens Com Port 1 and sends characters to an LCD screen ...

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    37

    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

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    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
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. init adopts zombie process?
    By password636 in forum Linux Programming
    Replies: 4
    Last Post: 07-01-2009, 10:05 AM
  2. create a child process that creates a child process
    By cus in forum Linux Programming
    Replies: 9
    Last Post: 01-13-2009, 01:14 PM
  3. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  4. Problem with forking a process
    By Unitedroad in forum C Programming
    Replies: 10
    Last Post: 10-04-2007, 01:43 AM
  5. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21