Set ip settings from cpp(Qt)

32 Views Asked by At

Its really hard going to code to save the ip settings(RegSetValueEx()) from cpp(By registry editing of WinCe). Its issue about encoding of string(which I parse to BYTE* and if I use hardcoded string,parsed it to same BYTE* it supports) Anybody can support for coding, will be good.Otherwise , please show me the different routes if you can. (Like batch file(setting ip with ipconfig) to execute from cpp).

HKEY hKey;
int res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Comm\\ENET1\\Parms\\TcpIp", 0, KEY_WRITE, &hKey);
const BYTE* data = (BYTE*)text;
long ret = RegSetValueEx(hKey,L"IpAddress",0,REG_MULTI_SZ,data,16);
RegCloseKey(HKEY_LOCAL_MACHINE);

It should save ip on WinCe from cpp.

  1. By batch file executing from cpp.
  2. Registry editing from cpp.
  3. Or any other method.
0

There are 0 best solutions below