Example #1
0
void __fastcall TRigCtlMain::FormShow( TObject */*Sender*/ )
{
   TIniFile * t = new TIniFile( ".\\Configuration\\RigSelect.ini" );
   mfg = t->ReadString( "RigControl", "Manufacturer", "NoMfG" );
   model = t->ReadString( "RigControl", "Model", "NoMoDeL" );
   delete t;
   makeRPCObjects();
   XMPPInitialise( "RigCtl" );
   rig_load_all_backends();

   selected = -1;
   int status = rig_list_foreach( print_model_list, NULL );
   if ( status != RIG_OK )
   {
      char buff[ 1024 ];
      sprintf( buff, "rig_list_foreach: error = %s \n", rigerror( status ) );
      trace( buff );
   }
   RigCombo->Sorted = true;

   if ( selected != -1 )
   {
      RigCombo->ItemIndex = RigCombo->Items->IndexOfObject( ( TObject * ) selected );
      RigSelectButtonClick( this );
   }
   else
      RigCombo->ItemIndex = 0;
}
Example #2
0
void* Msclient(void*)
{
	TIniFile tf;
	char tmp[256];	

    if (!tf.Open(INI_FILE_NAME))
    {
        printf("can not find\n");
        exit(-1000);
    }

    int marketnum = tf.ReadInt("COMMON","MARKETDATANUM",1);
	int i = 0;

	for(;i<marketnum;i++)
	{
		sprintf(tmp,"MARKETDATA%d",i+1);
		CUstpMs ustpMs;
        ustpMs.InitInstance(tmp,INI_FILE_NAME,&tradepanel);
	}
    while(false)
	{
		SLEEP_SECONDS(5000);
	}
    return 0;
}
Example #3
0
//---------------------------------------------------------------------------
void __fastcall CTerminalRobotTyper::RestoreKeyInterval(){
   	TIniFile *ini = new TIniFile(GetCurrentDir() + "\\app.ini");
	int keyInterval = ini->ReadInteger(terminal->xmlConfig->TerminalID , "KeyboardInterval", terminal->panel->TrackBarKey->Position);
    delete ini;
	terminal->panel->TrackBarKey->Position =keyInterval;
    keyIntervalRestored =true;
}
Example #4
0
//---------------------------------------------------------------------------
// Сохраняю установки измерения в файл
bool SaveSettings(MeasurInfo& measurInfo)
{
        if (access(lpIniFileName.c_str(), 0) == 0)
        {
        	//
        	TIniFile *Ini = new TIniFile(lpIniFileName);
        	//
        	try
		{
                	if (Ini->SectionExists("History"))
                	{
                		Ini->WriteInteger("History", "type_check_watt", measurInfo.type_check_watt);
                		Ini->WriteFloat("History", "begin_lw", measurInfo.begin_lw);
                		Ini->WriteFloat("History", "end_lw", measurInfo.end_lw);
                		Ini->WriteFloat("History", "step_lw", measurInfo.step_lw);
                                Ini->WriteFloat("History", "calc_lw", measurInfo.calc_lw);
                		Ini->WriteFloat("History", "time_accumulation", measurInfo.time_accumulation);
                		Ini->WriteBool("History", "makeKorK_bw", measurInfo.makeKorK_bw);
                		Ini->WriteBool("History", "makeKorK_cw", measurInfo.makeKorK_cw);
                		Ini->WriteBool("History", "makeSetZero", measurInfo.makeSetZero);
                                return true;
                        }
		}
        	__finally
		{
	        	delete Ini;
                	Ini = NULL;
		}
        }
Example #5
0
//---------------------------------------------------------------------------
void __fastcall TForm1::CodeBtnClick(TObject *Sender)
{
  TCode Work;
  String S = "";
  // ask for code
  if (InputQuery("Usage Code Entry", "Enter the code", S)) {
    TIniFile* Ini = new TIniFile("ONGUARD.INI");
    try {
      // store the usage code in the ini file if it looks OK
      if (HexToBuffer(S, &Work, sizeof(Work))) {
        // save the value
        Ini->WriteString("Codes", "UsageCode", S);
        CodeLbl->Caption = S;

        // tell the code component to test the new code, reporting the results
        OgUsageCode1->CheckCode(true);
      }
    }
    catch (...) {
    	delete Ini;
      Ini = 0;
    }
		delete Ini;
  }
}
Example #6
0
// sets the default user settings
void PREFERENCES::SetDefaultSettings()
{
  TIniFile* storage = new TIniFile( ExtractFilePath( Application->ExeName ) + INIFILENAME_PREFERENCES );
  try
  {
    storage->WriteInteger( "Various", "DefaultUserLevel", UserLevel );
    #define WRITE_SCRIPT( name ) \
    if( !mCmdlineSpecified[ name ] ) \
      storage->WriteString( "Scripts", #name, Script[ name ] );
    WRITE_SCRIPT( AfterModulesConnected );
    WRITE_SCRIPT( OnExit );
    WRITE_SCRIPT( OnSetConfig );
    WRITE_SCRIPT( OnResume );
    WRITE_SCRIPT( OnSuspend );
    WRITE_SCRIPT( OnStart );

    #define WRITE_BUTTON( number ) \
    storage->WriteString( "Buttons", "Button" #number "Name", Buttons[ number ].Name ); \
    storage->WriteString( "Buttons", "Button" #number "Cmd", Buttons[ number ].Cmd );
    WRITE_BUTTON( 1 );
    WRITE_BUTTON( 2 );
    WRITE_BUTTON( 3 );
    WRITE_BUTTON( 4 );
  }
  catch(...) {}

  delete storage;
}
Example #7
0
//---------------------------------------------------------------------------
void __fastcall TPrefsForm::FormClose(TObject* Sender, TCloseAction& Action) {
  CheckPrefsInterOpt();
  CheckReadonlyOpt(PrefFileOpt);
  TIniFile* Ini = new TIniFile(PrefFileOpt);

  try {
    if (HotKeyComb->HotKey != 0)
      Ini->WriteBool("Options", "HotKeyEn", 1);
    else
      Ini->WriteBool("Options", "HotKeyEn", 0);
  } catch (...) {
    Application->MessageBoxA(LMessagesOpt.WritePrefsError, LMessagesOpt.Error, MB_OK + MB_ICONERROR);
  }

  delete Ini;

  if (NeedOnClose) {
    AnsiString StyleTx = StyleBox->Items->Strings[StyleIs];
    SNotesXMForm->TBXSwitcher1->Theme = StyleTx;
    SNotesXMForm->TBXSwitcher1->EnableXPStyles = WasXPEffects;
    SNotesXMForm->AllTabs->MultiLine = WasMultiLine;
    SNotesXMForm->CoolTray->IconVisible = WasTrayIcon;
    SNotesXMForm->AlphaBlend = WasTrans;
    SNotesXMForm->AlphaBlendValue = TransIs;

    if (WasTop)
      SNotesXMForm->AllTabs->TabPosition = tpTop;
    else
      SNotesXMForm->AllTabs->TabPosition = tpBottom;
  }
}
//---------------------------------------------------------------------------
void __fastcall TDllTestForm::FormShow(TObject *Sender)
{
    TIniFile    *IniFile;

    if (!FInitialized) {
        FInitialized     = TRUE;
        IniFile          = new TIniFile(FIniFileName);
        Top              = IniFile->ReadInteger(SectionWindow, KeyTop,    Top);
        Left             = IniFile->ReadInteger(SectionWindow, KeyLeft,   Left);
        Width            = IniFile->ReadInteger(SectionWindow, KeyWidth,  Width);
        Height           = IniFile->ReadInteger(SectionWindow, KeyHeight, Height);
        delete IniFile;
        DisplayMemo->Clear();

		DllHandle = LoadLibraryA("OverbyteIcsDLL1.dll");
        if (DllHandle == 0) {
            MyMessageBox("OverbyteIcsDLL1.dll not found", "Error", MB_OK);
            Application->Terminate();
            return;
        }

        IcsDllDemo = (TIcsDllDemo)GetProcAddress(DllHandle, "IcsDllDemo");
        if (IcsDllDemo == NULL) {
            MyMessageBox("IcsDllDemo not found (OverbyteIcsDLL1.dll)", "Error", MB_OK);
            Application->Terminate();
            return;
        }
    }
}
Example #9
0
void __fastcall TTestRigMain::FormShow( TObject */*Sender*/ )
{
   StartupTimer->Enabled = true;
   TIniFile * t = new TIniFile( ".\\Configuration\\RigSelect.ini" );
   mfg = t->ReadString( "TestRig", "Manufacturer", "NoMfG" );
   model = t->ReadString( "TestRig", "Model", "NoMoDeL" );
   delete t;
   rig_load_all_backends();

   selected = -1;
   int status = rig_list_foreach( print_model_list, NULL );
   if ( status != RIG_OK )
   {
      return ;
   }
   RigCombo->Sorted = true;

   if ( selected != -1 )
   {
      RigCombo->ItemIndex = RigCombo->Items->IndexOfObject( ( TObject * ) selected );
      RigSelectButtonClick( this );
   }
   else
      RigCombo->ItemIndex = 0;
}
Example #10
0
//---------------------------------------------------------------------------
bool __fastcall CIniFile::SearchFile(AnsiString strBarCode,AnsiString &strFileName)
{
  WIN32_FIND_DATA FindFileData;
  AnsiString strName;
  char *pFileName;
  TIniFile *pIniFile;
  bool bResult=false;
  
  strName.sprintf("%s*.ini",IniFile_Dir);
  HANDLE hFile=FindFirstFile(strName.c_str(),&FindFileData);
  if(hFile!=INVALID_HANDLE_VALUE)
  {
    while(FindNextFile(hFile,&FindFileData)!=0)
    {
      pFileName=FindFileData.cFileName;
      strName.sprintf("%s%s",IniFile_Dir,pFileName);
      pIniFile = new TIniFile(strName);
      AnsiString strCode=pIniFile->ReadString(Product_Section,"BarCode","0000");
      delete pIniFile;
      if(strCode==strBarCode)
      {
        strFileName=strName;
        bResult=true;
        break;
      }
    }
    FindClose(hFile);
  }

  return bResult;
}
//---------------------------------------------------------------------------
void __fastcall LoadFormPos(TForm *Form,
                            const AnsiString IniFileName,
                            const AnsiString SectionName,
                            const AnsiString KeyName)
{
    TIniFile   *IniFile;
    AnsiString sWindowPositions;

    if (IniFileName.Length() == 0)
        return;

    // Create inifile object => Open ini file
    IniFile = new TIniFile(IniFileName);

    // Formatage par défaut de la ligne de la section window
    sWindowPositions.SetLength(256);
    WindowPosToStr(sWindowPositions.c_str(), Form);

    // Get widow's position and size from ini file
    sWindowPositions = IniFile->ReadString(SectionName,
                                           KeyName,
                                           sWindowPositions);
    StrToWindowPos(sWindowPositions.c_str(), Form);

    // Destroy inifile object => close ini file
    IniFile->Free();
}
//---------------------------------------------------------------------------
void __fastcall SaveFormPos(TForm *Form,
                            const AnsiString IniFileName,
                            const AnsiString SectionName,
                            const AnsiString KeyName)
{
    TIniFile     *IniFile;
    TWindowState WindowState;
    char         Buffer[256];

    if (IniFileName.Length() == 0)
        return;

    // Create inifile object => Open ini file
    IniFile = new TIniFile(IniFileName);

    WindowState = Form->WindowState;

    // If window minimized or maximized, restore to normal state
    if (Form->WindowState != wsNormal)
        Form->WindowState = wsNormal;

    // Save the window's postion and size to the ini file
    IniFile->WriteString(SectionName,
                         KeyName,
                         WindowPosToStr(Buffer, Form));

    // Destroy inifile object => close ini file
    IniFile->Free();

    Form->WindowState = WindowState;
}
Example #13
0
// retrieves the default user settings
void PREFERENCES::GetDefaultSettings()
{
  TIniFile* storage = new TIniFile( ExtractFilePath( Application->ExeName ) + INIFILENAME_PREFERENCES );
  try
  {
    UserLevel = storage->ReadInteger( "Various", "DefaultUserLevel", USERLEVEL_ADVANCED );
    #define READ_SCRIPT( name ) \
    if( !mCmdlineSpecified[ name ] ) \
      Script[ name ] = storage->ReadString( "Scripts", #name, "" );
    READ_SCRIPT( AfterModulesConnected );
    READ_SCRIPT( OnExit );
    READ_SCRIPT( OnSetConfig );
    READ_SCRIPT( OnResume );
    READ_SCRIPT( OnSuspend );
    READ_SCRIPT( OnStart );

    #define READ_BUTTON( number ) \
    Buttons[ number ].Name = storage->ReadString( "Buttons", "Button" #number "Name", "" );\
    Buttons[ number ].Cmd = storage->ReadString( "Buttons", "Button" #number "Cmd", "" );
    READ_BUTTON( 1 );
    READ_BUTTON( 2 );
    READ_BUTTON( 3 );
    READ_BUTTON( 4 );
  }
  catch(...) {}

  delete storage;
}
Example #14
0
void __fastcall TFrmMain::PopupMenu1Popup(TObject* Sender)
{
    if (OpenOk == true)
    {
        AnsiString  iniSetFile = ExtractFilePath(Application->ExeName) + "BcdEditer.ini";
        AnsiString SectionName = ExtractFileName(CurrentOpenFile);
        int ColType;
        TIniFile* ini;
        ini = new TIniFile(iniSetFile);
        ColType = ini->ReadInteger(SectionName, "ColType" + IntToStr(sgEdit->Col), 0);
        delete ini;
        switch (ColType)
        {
            case 0:
                btIntType->Checked = true;
                btFloatType->Checked = false;
                btTxtType->Checked = false;
                break;
            case 1:
                btIntType->Checked = false;
                btFloatType->Checked = true;
                btTxtType->Checked = false;
                break;
            case 2:
                btIntType->Checked = false;
                btFloatType->Checked = false;
                btTxtType->Checked = true;
                break;
            default:
                btIntType->Checked = true;
                btFloatType->Checked = false;
        }
    }
}
Example #15
0
//---------------------------------------------------------------------------
void __fastcall TFtpServerForm::SaveConfig(void)
{
    TIniFile *IniFile;

    IniFile = new TIniFile(FIniFileName);
    IniFile->WriteString(SectionData, KeyPort, FPort);
    IniFile->Free();
}
Example #16
0
//---------------------------------------------------------------------------
void __fastcall TFtpServerForm::LoadConfig(void)
{
    TIniFile *IniFile;

    IniFile = new TIniFile(FIniFileName);
    FPort   = IniFile->ReadString(SectionData, KeyPort, "ftp");
    IniFile->Free();
}
Example #17
0
//---------------------------------------------------------------------------
void __fastcall TForm1::ReadConfig ()    //读取配置
  {
    TIniFile *ini;
    ini = new TIniFile(ChangeFileExt(Application->ExeName,".INI "));
    Form1->Top = ini->ReadInteger( "Form ", "Top ", 100 );
    Form1->Left = ini->ReadInteger( "Form ", "Left ", 100 );
    AnsiString Caption =   ini->ReadString( "Form ", "Caption ", "科传接驳数据合规性检查程序" );
    Form1->Edit1->Text =  ini->ReadString( "Form ", "DefaultDir", "c:\\" );
    delete ini;
   }
Example #18
0
//---------------------------------------------------------------------------
void __fastcall TGetTrackThread::OpenDBDetecotr()
{
    if(!ShowReportEXE("TForm_DBDetecter",NULL))
    {
        TIniFile* ini = new TIniFile(ChangeFileExt( Application->ExeName, ".INI" ));        //free in next 2 line
        ini->WriteString("DBCHECK","DCH","false");
        delete ini;
    	ShellExecute(CallCenter_Main_Form, "open","DBDetector.exe", NULL, NULL, NULL);
    }
}
Example #19
0
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
    TIniFile *ini;
    ini = new TIniFile(ChangeFileExt( Application->ExeName, ".INI " ) );
    ini->WriteInteger( "Form ", "Top ", Top );
    ini->WriteInteger( "Form ", "Left ", Left );
    ini->WriteString ( "Form ", "Caption ", Caption );
    ini->WriteString ( "Form ", "DefaultDir ", Edit1->Text );
    delete ini;        
}
Example #20
0
void __fastcall TMainForm::FormCreate(TObject *Sender) {
    TIniFile *ini = new TIniFile(iniFile);
    try {
        fcPanel->Caption = ini->ReadString("FileName", "file-copy", curDir + "data\\C_wzl");
        cPanel->Caption = ini->ReadString("FileName", "cyclogram", curDir + "data\\CB_4z");
    }
    __finally {
        ini->Free();
        loadAndPrintAll();
    }
}
Example #21
0
//---------------------------------------------------------------------------
void __fastcall TTcpSrvForm::FormClose(TObject *Sender, TCloseAction &Action)
{
    TIniFile *IniFile;

    IniFile = new TIniFile(FIniFileName);
    IniFile->WriteInteger(SectionWindow, KeyTop,    Top);
    IniFile->WriteInteger(SectionWindow, KeyLeft,   Left);
    IniFile->WriteInteger(SectionWindow, KeyWidth,  Width);
    IniFile->WriteInteger(SectionWindow, KeyHeight, Height);
    delete IniFile;
}
//---------------------------------------------------------------------------
void __fastcall THttpTestForm::FormClose(TObject *Sender, TCloseAction &Action)
{
    TIniFile *IniFile;

    IniFile = new TIniFile(FIniFileName);
    IniFile->WriteString("Data", "URL",       URLEdit->Text);
    IniFile->WriteString("Data", "ProxyHost", ProxyHostEdit->Text);
    IniFile->WriteString("Data", "ProxyPort", ProxyPortEdit->Text);
    IniFile->WriteString("Data", "Data",      DataEdit->Text);
    IniFile->WriteString("Data", "DateTime",  DateTimeEdit->Text);
    delete IniFile;
}
Example #23
0
//---------------------------------------------------------------------------
void __fastcall TPOP3ExcercizerForm::FormCloseQuery(
    TObject *Sender, bool &CanClose)
{
    TIniFile *IniFile;

    IniFile = new TIniFile(IniFileName);
    IniFile->WriteString("Data", "Host",     HostEdit->Text);
    IniFile->WriteString("Data", "Port",     PortEdit->Text);
    IniFile->WriteString("Data", "UserName", UserNameEdit->Text);
    IniFile->WriteString("Data", "Password", PassWordEdit->Text);
    delete IniFile;
}
Example #24
0
//---------------------------------------------------------------------------
void __fastcall TPOP3ExcercizerForm::FormCreate(TObject *Sender)
{
    TIniFile *IniFile;

    IniFile            = new TIniFile(IniFileName);
    HostEdit->Text     = IniFile->ReadString("Data", "Host",     "");
    PortEdit->Text     = IniFile->ReadString("Data", "Port",     "");
    UserNameEdit->Text = IniFile->ReadString("Data", "UserName", "");
    PassWordEdit->Text = IniFile->ReadString("Data", "Password", "");
    delete IniFile;
    InfoLabel->Caption = "";
}
Example #25
0
void __fastcall TFrmMain::btTxtTypeClick(TObject *Sender)
{
if(OpenOk==true){
   AnsiString  iniSetFile=ExtractFilePath(Application->ExeName)+"BcdEditer.ini";
   AnsiString SectionName=ExtractFileName(CurrentOpenFile);
   TIniFile *ini;
   ini = new TIniFile( iniSetFile );
   ini->WriteInteger(SectionName,"ColType"+IntToStr(sgEdit->Col),2);
   delete ini;
   thOpen->ColType[sgEdit->Col]=2;
   OpenFileCol(CurrentOpenFile,sgEdit->Col,2);
}
}
Example #26
0
// ---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner) : TForm(Owner) {
	TIniFile *Ini = new TIniFile(ExtractFilePath(Application->ExeName) +
		"settings.ini");
	Grid1->Cells[0][0] = "Дата";
	Grid1->Cells[1][0] = "Концентрация";
	Series1->Clear();
	Console->Lines->Add("Программа загружена...");
	Console->Lines->Add("Выбран порт " + Ini->ReadString("Port", "Addr",
		"COM1"));
	Console->Lines->Add("Скорость " + Ini->ReadString("Port", "BaudRate",
		"9600"));

}
Example #27
0
void __fastcall TMainForm::FormDestroy(TObject *Sender) {
    if( !isCorrect ) // если выбраные файлы не открылись, не нужно их сохранять в .ini
        return;

    TIniFile *ini = new TIniFile(iniFile);
    try {
        ini->WriteString( "FileName", "file-copy", fcPanel->Caption );
        ini->WriteString( "FileName", "cyclogram", cPanel->Caption );
    }
    __finally {
        ini->Free();
        clearAll();
    }
}
Example #28
0
void __fastcall TFrmMain::N1Click(TObject *Sender)
{
     AnsiString  iniSetFile=ExtractFilePath(Application->ExeName)+"BcdEditer.ini";
     AnsiString SectionName=ExtractFileName(CurrentOpenFile);
     int ColType;
     FrmTitle->edTitle->Text=sgEdit->Cells[sgEdit->Col][0];
     if(FrmTitle->ShowModal()==mrOk){
            TIniFile *ini;
            ini = new TIniFile( iniSetFile );
            ini->WriteString(SectionName,"ColTitle"+IntToStr(sgEdit->Col),FrmTitle->edTitle->Text);
            delete ini;
            sgEdit->Cells[sgEdit->Col][0]=FrmTitle->edTitle->Text;
     }
}
Example #29
0
//---------------------------------------------------------------------------
void __fastcall TForm1::RemoveBtnClick(TObject *Sender)
{
  TIniFile* Ini = new TIniFile("ONGUARD.INI");
  try {
    Ini->DeleteKey("Codes", "UsageCode");
  }
  catch (...) {
  	delete Ini;
    Ini = 0;
  }
  delete Ini;

  // tell the code component to test the new code, reporting the results
  OgUsageCode1->CheckCode(true);
}
//---------------------------------------------------------------------------
void __fastcall TDllTestForm::FormClose(TObject *Sender, TCloseAction &Action)
{
    TIniFile *IniFile;

    IniFile = new TIniFile(FIniFileName);
    IniFile->WriteInteger(SectionWindow, KeyTop,    Top);
    IniFile->WriteInteger(SectionWindow, KeyLeft,   Left);
    IniFile->WriteInteger(SectionWindow, KeyWidth,  Width);
    IniFile->WriteInteger(SectionWindow, KeyHeight, Height);
    delete IniFile;
    if (DllHandle) {
        FreeLibrary(DllHandle);
        DllHandle = 0;
    }
}