Esempio n. 1
0
//---------------------------------------------------------------------------
AnsiString __fastcall Regread(AnsiString folder,AnsiString Key,int mode)
{
 AnsiString S="";
 int p,p1;
 TRegistry *Registry = new TRegistry;
 try
 {
  Registry->RootKey = HKEY_LOCAL_MACHINE;
  if(Registry->OpenKeyReadOnly(folder))
  {
   if(mode==0)
    S = Registry->ReadString(Key);
   if(mode==1)
    Registry->WriteString("ServerN",Key);
   if(mode==2)
	Registry->WriteString("DB",Key);

  }
  Registry->CloseKey();
 }
 __finally
 {
  delete Registry;
 }
 return S;
}
Esempio n. 2
0
//---------------------------------------------------------------------------
 void __fastcall TestCarte::Scan_Arduino()
{
TRegistry *registre = new TRegistry();
registre->RootKey = HKEY_LOCAL_MACHINE;
if (registre->OpenKeyReadOnly("SYSTEM\\CurrentControlSet\\Services\\usbser\\Enum") && registre->ValueExists("0"))
	{
	EtatDetect = true;
	}
	else
		{
		EtatDetect = false;
		}
delete registre;
//valable seulement pour 1 carte Arduino, sinon incrémente...
//HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbser\Enum -> 0 -> USB\VID_2341&PID_0042\6493633303735151D061
//HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM -> \Device\USBSER000 -> COMxx
 }