| tnjgraham (26) | |
|
Hey, 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 In Advance | |
|
|
|
| bobdabilder (76) | |
|
isn't that the dcb.fDtrControl? http://msdn.microsoft.com/en-us/library/windows/desktop/aa363214%28v=vs.85%29.aspx | |
|
|
|
| tnjgraham (26) | |
|
Bobdabilder, 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: Baud Parity Data Bits Stop Bits Timeout XON/XOFF CTS handshaking DSR handshaking DSR sensitivity DTR circuit RTS circuit At this time, I would like to know if one of the above settings is actually Flow Control. Any Help will be greatly appreciated. | |
|
|
|
| bobdabilder (76) | |||||
|
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
I have tested these in the command prompt. if you want to modify the registry value: I found it at
mine was com1 if the string value ends in a blank, it is none if the string value ends in x, it is xon/xoff if the string value ends in p, it is hardware Hope this helps. Please double check. this is win7 32 bit machine. edit: added link http://support.microsoft.com/kb/112841 | |||||
|
Last edited on
|
|||||
| rockdenim (6) | |
| On the system where you set up flow control, become superuser or assume the equivalent root role. | |
|
|
|