Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
serialport.h - missing something simple im sure
I'm trying to use serialport.h MFC wrapper to send data to COM1. Where do I put the
port.Open(bla bla bla)
to ensure that the port is opened the instant the program is initiated, and only closes when the program exits? At the moment I'm stuck trying to figure out the scopes of each function. If I put the declaration in the message handler it works fine but i dont want the added time taken to open the port and close it again every time, plus I may have a different thread recieving at the same time or very shortly after. Where ever I put it it either throws compile-time errors about 'port' not existing or it closes it immediately after sending. Its simple in proceedural - you just lob the open in at the top and the close at the end, in a GUI i'm stuck
I'd post the full code but I think people would get mad - its a long program.
0 · ·