I am working on this project where when a user selects a particular com port via a config dialog, the software needs to retrieve the OS COM Port settings for the particaul port that was selected. For example, If I select COM Port 1 on the config dialog in project, the software needs to retrieve the OS current COM Port 1 settings(Baud Rate, Data bits,Parity, Stop bit, and Flow Control). Once OS settings are retrieved, I neeed to update my project dialog with the OS COM Port Settings. Once dialog settings are updated to OS COM Port settings, users will have an opportuntiy to change current port settings by clicking a button. Once user has changed settings for a port,the OS COM Port current settings needs to be updated to what user input. As of now, the above is working for all settings except Flow Control by using CreateFile(),SetCommState(),and GetCommState(). However, the DCB struct does not have a member for the Flow Control setting, well as far as I can tell. With this in mind, how can I retrieve/set Flow Control settings for system com port. The following are the possible settings for Flow Control:Xon/Xoff, Hardware, None.
Thanks for your response. However, values for dcb.fDtrControl(DTR_CONTROL_DISABLE,DTR_CONTROL_ENABLE, and DTR_CONTROL_HANDSHAKE) on link doesn't match(well to me, don't know much about Flow Control) the Flow Control options(None, Xon/Xoff, Hardware) for System Com Port. With this in mind, is it ok to assume the following:
DTR_CONTROL_DISABLE = None
DTR_CONTROL_ENABLE = Xon/Xoff
DTR_CONTROL_HANDSHAKE = Hardware
Also when typing mode at the command prompt to get the current port settings, I do not see the Flow Control setting. The following are the port settings that are shown:
At this time, I would like to know if one of the above settings is actually Flow Control.
Ok, I'll give you my research on this. The command prompt com settings and the control panel device settings are different. the control panel settings are stored in the registry while the command line settings get reset at each reboot according to microsoft.
The following dcb structure members should be zero if not one of the two cases