Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

How to change COM1 baud rate in Windows registry on a PC from C++/Win7?

$
0
0

Hi,

I'd like to find out how to change the baud rate in the Windows 7 registry on a PC from a C++ application for COM1.  From what I've read, I it appears to involve the 4 functions below.  I've included some values that I'm not sure are correct.  There may be a sub-key involved, I don't know.  I've tried searching and reviewing functions on MSDN, but can't figure this one out.  Could someone please describe the exact function parameters including any argument declarations for this.  Thanks much, CodeMan4.

//1)

HKEY hKey;

RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports",0,KEY_READ,&hKey);

//2)

char* value;

DWORD value_length = sizeof (DWORD);

RegQueryValueEx(hKey, L"COM1", NULL, NULL, (LPBYTE)&value, &value_length);

//3)

value = "57600,n,8,1";

RegSetValueEx(hKey,L"COM1",0, REG_SZ, (LPBYTE)&value,value_length); 

//4)

RegCloseKey (hKey);





Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>