Exemplo n.º 1
0
//===========================================================================
void Tform_Main::ReadDataFromRegistry()
{
    try {
        try {
           Reg->RootKey = HKEY_LOCAL_MACHINE;
           Reg->OpenKey("Software\\Home\\" + ShortAppName_WA_ext, true);
                MaxTime           = Reg->ReadFloat  ("MaxTime" );
                TimeElapsed       = Reg->ReadFloat  ("TimeElapsed" );
                LastGameDate      = Reg->ReadInteger("LastGameDate");
                SoftsCount        = Reg->ReadInteger("SoftsCount");
                isShowTimer       = Reg->ReadBool   ("isShowTimer");
                isChildMomEnabled = Reg->ReadBool   ("isChildMomEnabled");
                for ( int i = 0; i < SoftsCount; i++ ) Softs[i] = Reg->ReadString("Soft" + IntToStr(i));
           Reg->CloseKey();
            // **********************
            int CurrentDate = Date();
            if ( CurrentDate != LastGameDate )
            {
                TimeElapsed = MaxTime * 1000.0;
                LastGameDate = CurrentDate;

                SaveDataToRegistry();
            }
            // **********************
        } catch ( ... )
        {
            TimeElapsed = MaxTime * 1000.0;
            Reg->CloseKey();
            SaveDataToRegistry();
        }
    } __finally {
         Reg->CloseKey();
    }
}
Exemplo n.º 2
0
//===========================================================================
void Tform_Main::ReadDataFromRegistry()
{
    AnsiString Name;
    TRegistry *Reg = NULL;
    try {
        try {
           Reg = new TRegistry;
           AnsiString appName = ExtractFileName(Application->ExeName);
           appName.SetLength(appName.Length() - 4);

           Reg->RootKey = HKEY_LOCAL_MACHINE;
           Reg->OpenKey("Software\\InnalabsUA\\ccg_QFactor", true);

            DFT_DeltaFreq = Reg->ReadFloat("DFT_DeltaFreq");

            DTF_InterpolationPointsCount = Reg->ReadInteger("DTF_InterpolationPointsCount");
            FFT_MaxPointsCount = Reg->ReadInteger("FFT_MaxPointsCount");
            SoundCardIndex = Reg->ReadInteger("SoundCardIndex");
            FreqSoundCardIndex = Reg->ReadInteger("FreqSoundCardIndex");

       } catch ( ... ){
            Reg->CloseKey();
            SaveDataToRegistry();
        }
    } __finally {
        Reg->CloseKey();
        if (Reg != NULL)
            delete Reg;
    }
}
Exemplo n.º 3
0
//===========================================================================
int  CCVGxm_gk::Start()
{
   // ----------
    SaveDataToRegistry("CVGxm_gk");

   // ----------
    UART_Frequency      = ExtendedParamValues[0];
    PackedLength        = ExtendedParamValues[2];
    InfoPackedLength    = ExtendedParamValues[2];
   isRealTimeProcessing = true;

    SummationCount                = UART_Frequency / SamplingFreq;
    if ( SummationCount < 1 ) SummationCount = 1;
    SummationCount_invert         = 1.0 / (double)SummationCount;
    CurrentSummationPoint         = 0;

    Storage->file_Param.StorageT0[0] = SummationCount / (double) UART_Frequency;

    // ---- Сэтапю каналы ----
	CountUARTValues = 19;
    Storage->SetItemsCount( CountUARTValues + 0);

    Storage->Items[ 0]->SetName("GyroOut\0"      );
    Storage->Items[ 1]->SetName("Temperature\0"  );

    Storage->Items[ 2]->SetName("X_Frequency\0"    );
    Storage->Items[ 3]->SetName("Y_Frequency\0"    );

    Storage->Items[ 4]->SetName("X_Excitation\0" );
    Storage->Items[ 5]->SetName("Y_Excitation\0" );

    Storage->Items[ 6]->SetName("X_Antinode\0" );
    Storage->Items[ 7]->SetName("Y_Antinode\0"  );

    Storage->Items[ 8]->SetName("Phase_ADC\0" ); isNeedCalcMiddledValue[8] = false;
    Storage->Items[ 9]->SetName("Phase_DAC\0" ); isNeedCalcMiddledValue[9] = false;

    Storage->Items[10]->SetName("Quadrature\0" );
    Storage->Items[11]->SetName("Error_Phase\0" );
    Storage->Items[12]->SetName("Error_X_Frequency\0" );

    Storage->Items[13]->SetName("Error_Y_Frequency\0" );
    Storage->Items[14]->SetName("DeltaFrequency\0" );

    Storage->Items[15]->SetName("Kxy\0" );

    Storage->Items[16]->SetName("X_Exc_phase\0" );
    Storage->Items[17]->SetName("Y_Exc_phase\0" );

   // -------------
    if ( CBaseDevice::Start()                    == -1 ) return -1;
    if ( OpenDataSaveFile( &h_file[0], Storage ) == -1 ) return -2;

   // -----
    return 0;
}
Exemplo n.º 4
0
//===========================================================================
void __fastcall Tform_Main::FormCloseQuery(TObject *Sender, bool &CanClose)
{
    SaveDataToRegistry();

    char mess[255] = { 0 }; sprintf (mess, "%s - Confirmation", "ChildMom");
    int MessageBoxResult = MessageBox(Handle, "Закрыть программу?", mess, MB_YESNO|MB_ICONQUESTION|MB_TASKMODAL);
//    if ( MessageBoxResult == IDNO ) return;

    CanClose = ( MessageBoxResult != IDNO );
}
Exemplo n.º 5
0
//===========================================================================
void __fastcall Tform_Main::AppMessage (tagMSG &msg, bool &handled)
{
    if (msg.message == WM_WAKEUP )
    {
        this->Visible     = true;
        this->WindowState = wsNormal;
        Label3->Caption   = "ПОКАЗАЛСЯ " + IntToStr(++counter) + " раз ";
        handled = true;
    }
    if (msg.message == WM_CLOSE )
    {
        //aCanClose = true;
        //Close();
    }
    if (msg.message == WM_SYSCOMMAND )
    {
        if ( msg.wParam == SC_MINIMIZE )
        {
            Application->ShowMainForm = false;
            this->Visible = false;

            SaveDataToRegistry();

            handled = true;
        }
    }

    if (msg.message == WM_NCLBUTTONDOWN )
    {
        if ( msg.wParam == 8 )
        {
            Application->ShowMainForm = false;
            this->Visible = false;

            SaveDataToRegistry();

            handled = true;
        }
    }

}
Exemplo n.º 6
0
//===========================================================================
void __fastcall Tform_Main::toolbutton_AddClick(TObject *Sender)
{
    if ( combobox_WindowsList->ItemIndex == -1 ) return;

    for ( int i = 0; i < SoftsCount; i++ )
        if ( Softs[i] == combobox_WindowsList->Text ) return;

    Softs[SoftsCount++] = combobox_WindowsList->Text;

    UpdateInterface();
    // ------
    SaveDataToRegistry();
}
Exemplo n.º 7
0
/***********************************************************************
 *
 *           OSK_DlgClose
 *
 *  Handling of WM_CLOSE
 */
int OSK_DlgClose(void)
{
    KillTimer(Globals.hMainWnd, Globals.iTimer);

    /* Release Ctrl, Shift, Alt keys */
    OSK_ReleaseKey(SCAN_CODE_44); // Left shift
    OSK_ReleaseKey(SCAN_CODE_57); // Right shift
    OSK_ReleaseKey(SCAN_CODE_58); // Left ctrl
    OSK_ReleaseKey(SCAN_CODE_60); // Left alt
    OSK_ReleaseKey(SCAN_CODE_62); // Right alt
    OSK_ReleaseKey(SCAN_CODE_64); // Right ctrl

    /* delete GDI objects */
    if (Globals.hBrushGreenLed) DeleteObject(Globals.hBrushGreenLed);

    /* Save the settings to the registry hive */
    SaveDataToRegistry();

    return TRUE;
}
Exemplo n.º 8
0
//===========================================================================
CCVGxm_gk::~CCVGxm_gk()
{
    SaveDataToRegistry("CVGxm_gk");
}
Exemplo n.º 9
0
//===========================================================================
void __fastcall TfrmMain::FormClose(TObject *Sender, TCloseAction &Action)
{
   SaveDataToRegistry();
}
Exemplo n.º 10
0
//===========================================================================
void __fastcall Tform_Main::FormDestroy(TObject *Sender)
{
    SaveDataToRegistry();
    delete graphs;
}
Exemplo n.º 11
0
/***********************************************************************
 *
 *       OSK_DlgProc
 */
INT_PTR APIENTRY OSK_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch (msg)
    {
        case WM_INITDIALOG:
            OSK_DlgInitDialog(hDlg);
            return TRUE;

        case WM_TIMER:
            OSK_DlgTimer();
            return TRUE;

        case WM_CTLCOLORSTATIC:
            if ((HWND)lParam == GetDlgItem(hDlg, IDC_LED_NUM))
            {
                if (GetKeyState(VK_NUMLOCK) & 0x0001)
                    return (INT_PTR)Globals.hBrushGreenLed;
                else
                    return (INT_PTR)GetStockObject(BLACK_BRUSH);
            }
            if ((HWND)lParam == GetDlgItem(hDlg, IDC_LED_CAPS))
            {
                if (GetKeyState(VK_CAPITAL) & 0x0001)
                    return (INT_PTR)Globals.hBrushGreenLed;
                else
                    return (INT_PTR)GetStockObject(BLACK_BRUSH);
            }
            if ((HWND)lParam == GetDlgItem(hDlg, IDC_LED_SCROLL))
            {
                if (GetKeyState(VK_SCROLL) & 0x0001)
                    return (INT_PTR)Globals.hBrushGreenLed;
                else
                    return (INT_PTR)GetStockObject(BLACK_BRUSH);
            }
            break;

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDCANCEL:
                {
                    EndDialog(hDlg, FALSE);
                    break;
                }

                case IDM_EXIT:
                {
                    EndDialog(hDlg, FALSE);
                    break;
                }

                case IDM_ENHANCED_KB:
                {
                    if (!Globals.bIsEnhancedKeyboard)
                    {
                        /* 
                            The user attempted to switch to enhanced keyboard dialog type.
                            Set the member value as TRUE, destroy the dialog and save the data configuration into the registry.
                        */
                        Globals.bIsEnhancedKeyboard = TRUE;
                        EndDialog(hDlg, FALSE);
                        SaveDataToRegistry();

                        /* Change the condition of enhanced keyboard item menu to checked */
                        CheckMenuItem(GetMenu(hDlg), IDM_ENHANCED_KB, MF_BYCOMMAND | MF_CHECKED);
                        CheckMenuItem(GetMenu(hDlg), IDM_STANDARD_KB, MF_BYCOMMAND | MF_UNCHECKED);

                        /* Finally, display the dialog modal box with the enhanced keyboard dialog */
                        DialogBoxW(Globals.hInstance,
                                   MAKEINTRESOURCEW(MAIN_DIALOG_ENHANCED_KB),
                                   GetDesktopWindow(),
                                   OSK_DlgProc);
                    }

                    break;
                }

                case IDM_STANDARD_KB:
                {
                    if (Globals.bIsEnhancedKeyboard)
                    {
                        /*
                            The user attempted to switch to standard keyboard dialog type.
                            Set the member value as FALSE, destroy the dialog and save the data configuration into the registry.
                        */
                        Globals.bIsEnhancedKeyboard = FALSE;
                        EndDialog(hDlg, FALSE);
                        SaveDataToRegistry();

                        /* Change the condition of standard keyboard item menu to checked */
                        CheckMenuItem(GetMenu(hDlg), IDM_ENHANCED_KB, MF_BYCOMMAND | MF_UNCHECKED);
                        CheckMenuItem(GetMenu(hDlg), IDM_STANDARD_KB, MF_BYCOMMAND | MF_CHECKED);

                        /* Finally, display the dialog modal box with the standard keyboard dialog */
                        DialogBoxW(Globals.hInstance,
                                   MAKEINTRESOURCEW(MAIN_DIALOG_STANDARD_KB),
                                   GetDesktopWindow(),
                                   OSK_DlgProc);
                    }

                    break;
                }

                case IDM_ABOUT:
                {
                    OSK_About();
                    break;
                }

                default:
                    OSK_DlgCommand(wParam, (HWND)lParam);
                    break;
            }
            break;

        case WM_CLOSE:
            OSK_DlgClose();
            break;
    }

    return 0;
}
Exemplo n.º 12
0
//===========================================================================
void __fastcall Tform_Main::CheckBox2Click(TObject *Sender)
{
    isShowTimer = CheckBox2->Checked;
    SaveDataToRegistry();
}
Exemplo n.º 13
0
//===========================================================================
void __fastcall Tform_Main::CheckBox1Click(TObject *Sender)
{
    isChildMomEnabled = CheckBox1->Checked;
    SaveDataToRegistry();
}