void TestRunnerDlg::OnBnClickedAutorun() { CButton *autoRunBtn = (CButton *)GetDlgItem (IDC_CHK_AUTORUN); CWinApp* pApp = AfxGetApp(); pApp->WriteProfileInt("Tests", "autoRun", autoRunBtn->GetCheck()); }
void Display::Onconnect() { int port; CString sername,username,mesg; //Write to log file log.WriteString("\n Connecting to Server"); //Get data from dialog box GetDlgItemText(IDC_EDIT1,sername); GetDlgItemText(IDC_EDIT3,username); port=GetDlgItemInt(IDC_EDIT2); if(username=="" || sername=="" ) { AfxMessageBox("Please Enter the data properly"); return; } if(success) { anicon->Play(0,-1,-1); log.WriteString("\n Playing data"); } //Connect the client to server username.MakeUpper(); sockclt.name=username; ///fix doan nay lai //B0 kiem tra checkbox CButton *x = (CButton*)GetDlgItem(IDC_CHECK); CString strKey; if (x->GetCheck()==1) { GetDlgItemText(IDC_EDIT_KEY,strKey); if(strKey=="" ) { AfxMessageBox("Please Enter the key"); return; } isKey=true; char key[129]; HashSCKey (key,strKey); if (radio3->GetCheck()) { bcpTemp1=new CBlockCipherProvider; bcpTemp2=new CBlockCipherProvider; bcpTemp1->Init(key); bcpTemp2->Init(key); isStream=false; } else { scpTemp1=new CStreamCipherProvider; scpTemp2=new CStreamCipherProvider; scpTemp1->CMInit(key); scpTemp2->CMInit(key); isStream=true; } } else isKey=false; //B1 nhap thong tin tu textbox //B2 bung key //B3 chuyen thanh khoa SetDlgItemText(IDC_BUTTON1,"Connecting"); if(sockclt.Connect(sername,port)) log.WriteString("\n Successfully Connected to Server"); else { SetDlgItemText(IDC_BUTTON1,"&Connect"); if(success) anicon->Stop(); MessageBox("Unable to Connect to Server\nVerify if Server name and Port are correct"); log.WriteString("\n Unable to connect to Server"); return; } isconnected=TRUE; if(success) anicon->Stop(); //Send the login message to server mesg="NEW:"+username; if(sockclt.Send(mesg,mesg.GetLength())) log.WriteString("\n login Mesg sent to Server"); else log.WriteString("\n Unable to send mesg to Server"); updateState(FALSE,TRUE); }
void CClientDlg::OnBtnStarttalk() { // TODO: Add your control notification handler code here if(0 != m_lLoginHandle) { // First set audio encode format in audio talk m_curTalkMode.encodeType = DH_TALK_DEFAULT; // DH_TALK_DEFAULT is default way. Usually it is pcm type without head. m_curTalkMode.dwSampleRate = 8000; m_curTalkMode.nAudioBit = 8; int nIndex = m_ctlEncodeType.GetCurSel(); if (-1 != nIndex) { DWORD dwItemData = m_ctlEncodeType.GetItemData(nIndex); m_curTalkMode = m_lstTalkEncode.type[dwItemData]; } // m_curTalkMode.dwSampleRate = 16000; // m_curTalkMode.nAudioBit = 16; BOOL bSuccess = CLIENT_SetDeviceMode(m_lLoginHandle, DH_TALK_ENCODE_TYPE, &m_curTalkMode); // 设置喊话参数 NET_SPEAK_PARAM stSpeak = {sizeof(NET_SPEAK_PARAM)}; stSpeak.nMode = 0; stSpeak.nSpeakerChannel = 0; CButton* pButton = reinterpret_cast<CButton*>(GetDlgItem(IDC_CHECK_SPEAK)); if (0 != pButton) { if (BST_CHECKED == pButton->GetCheck()) { stSpeak.nMode = 1; // 喊话 // 喊话喇嘛通道 int nIndex = m_ctlSpeakerChl.GetCurSel(); if (-1 != nIndex) { stSpeak.nSpeakerChannel = m_ctlSpeakerChl.GetItemData(nIndex); } } } bSuccess = CLIENT_SetDeviceMode(m_lLoginHandle, DH_TALK_SPEAK_PARAM, &stSpeak); if (!bSuccess) { MessageBox(ConvertString("Set speaker param failure!"), ConvertString("Prompt")); } // Then enable audio talk LONG lTalkHandle = CLIENT_StartTalkEx(m_lLoginHandle, AudioDataCallBack, (DWORD)this); if(0 != lTalkHandle) { m_hTalkHandle = lTalkHandle; GetDlgItem(IDC_BTN_STARTTALK)->EnableWindow(FALSE); GetDlgItem(IDC_BTN_STOPTALK)->EnableWindow(TRUE); // Then enbale local record function.(Does not call it if it is a one-direction audio talk.) BOOL bSuccess = CLIENT_RecordStart(); if(bSuccess) { m_bRecordStatus = TRUE; } else { CLIENT_StopTalkEx(m_hTalkHandle); MessageBox(ConvertString("Start local record failed!"), ConvertString("Prompt")); } } else { MessageBox(ConvertString("Open talk failed!"), ConvertString("Prompt")); } } else { MessageBox(ConvertString("Please login first!"), ConvertString("Prompt")); } }
void CTxMsgWndJ1939::OnBnClickedSend() { UpdateData(); LPARAM lParam = 0; GetICANDIL()->DILC_GetControllerParams(lParam, 0, NUMBER_HW); UINT unChannel = (UINT) lParam; if (m_bNM == TRUE) { BYTE byAddress = (BYTE)m_omCurAddress.lGetValue(); BYTE byEcuName = (BYTE)m_omEcuName.lGetValue(); CButton* pButton = (CButton*)GetDlgItem(IDC_CLAIM_ADDRESS); if (pButton->GetCheck() == BST_CHECKED) { for (UINT i = 0; i < unChannel; i++) { GetIJ1939DIL()->DILIJ_NM_ClaimAddress(m_sClientParams.m_dwClientId, i + 1, byAddress); } } pButton = (CButton*)GetDlgItem(IDC_RQST_ADDRESS); if (pButton->GetCheck() == BST_CHECKED) { for (UINT i = 0; i < unChannel; i++) { GetIJ1939DIL()->DILIJ_NM_RequestAddress(m_sClientParams.m_dwClientId, i + 1, DEFAULT_PRIORITY, byAddress, byEcuName); } } pButton = (CButton*)GetDlgItem(IDC_CMD_ADDRESS); if (pButton->GetCheck() == BST_CHECKED) { UINT64 unECUNAME = m_omEcuName.lGetValue(); for (UINT i = 0; i < unChannel; i++) { GetIJ1939DIL()->DILIJ_NM_CommandAddress(m_sClientParams.m_dwClientId, i + 1, unECUNAME, byAddress, DEFAULT_PRIORITY, byAddress, ADDRESS_ALL); } } } else { if ((eGetTransState() == TRANS_STOPPED) && GetIJ1939DIL()->DILIJ_bIsOnline()) { m_sMsgToBeSent.m_unChannel = 1; CString omChannel; int nIndex = m_omComboChannel.GetCurSel(); if (nIndex != -1) { m_omComboChannel.GetLBText(m_omComboChannel.GetCurSel(), omChannel); m_sMsgToBeSent.m_unChannel = _ttoi(omChannel); } //Check for DLC length if (m_unDataLength > MAX_DATA_LEN_J1939) { CString omInvDLCMsg; omInvDLCMsg.Format("Invalid DLC value: %d, Please enter a value between 0 and %d", m_unDataLength, MAX_DATA_LEN_J1939); vSetStatusBarText(omInvDLCMsg); return; } //Data bytes if (m_omMsgDataEditVal.GetLength() > (INT)(2 * m_unDataLength)) { m_omMsgDataEditVal = m_omMsgDataEditVal.Left(2 * m_unDataLength); } //DLC m_sMsgToBeSent.m_unDLC = CString_2_ByteArray(m_omMsgDataEditVal, m_sMsgToBeSent.m_abyData, MAX_DATA_LEN_J1939); //Msg type m_sMsgToBeSent.m_eMsgType = eGetCurrMsgType(); //Destination address m_sMsgToBeSent.m_byDest = (BYTE)m_omTOEdit.lGetValue(); //Source address m_sMsgToBeSent.m_bySrc = (BYTE)m_omFromEdit.lGetValue(); //Priority m_sMsgToBeSent.m_byPriority = (BYTE)m_omPriorityEdit.lGetValue(); //PGN value CString omPGN; nIndex = m_omComboPGN.GetCurSel(); if (nIndex != -1) { m_omComboPGN.GetLBText(m_omComboPGN.GetCurSel(), omPGN); } else { m_omComboPGN.GetWindowText(omPGN); omPGN = "0x" + omPGN; } m_sMsgToBeSent.m_unPGN = unGetMsgIDFromName(omPGN); if (m_sMsgToBeSent.m_unPGN > MAX_LMT_FOR_PGN) { CString omPGN; omPGN.Format("Invalid PGN value: %x, Please enter a value between 0 and 0x%x", m_sMsgToBeSent.m_unPGN, MAX_LMT_FOR_PGN); vSetStatusBarText(omPGN); return; } //Now send the message //Check for cyclic transmission if (m_omCheckCyclic.GetCheck() == BST_CHECKED) { m_sMsgToBeSent.m_unTimerVal = (UINT)m_omMiliSecs.lGetValue(); vProcessTransmission(TRUE); if (m_bThreadStarted == FALSE) { m_sCyclicThread.m_pBuffer = this; m_sCyclicThread.m_unActionCode = INVOKE_FUNCTION; m_bThreadStarted = m_sCyclicThread.bStartThread(Cyclic_Transmission_Thread); SetEvent(m_sCyclicThread.m_hActionEvent); } else { m_sCyclicThread.m_pBuffer = this; m_sCyclicThread.m_unActionCode = INVOKE_FUNCTION; SetEvent(m_sCyclicThread.m_hActionEvent); } } else { vSetStatusBarText(""); //Clear status bar. SendSavedMessage(); } } else if (eGetTransState() == TRANS_STARTED) { vSetTransState(TRANS_TO_BE_STOPPED); SetEvent(sg_hMsgSent); SetEvent(m_sCyclicThread.m_hActionEvent); } } }
void CSearchAdvancedBox::OnDCClicked() { CButton* pBox = &m_wndCheckBoxDC; pBox->SetCheck( pBox->GetCheck() == BST_CHECKED ? BST_UNCHECKED : BST_CHECKED ); }
void CWSPrintDialog::OnCheckChanges() { CButton *pButton; pButton = (CButton*)GetDlgItem(IDC_CHECK_CHANGES); m_bChangesOnly = pButton->GetCheck(); }
void CWSPrintDialog::OnCheckBw() { CButton *pButton; pButton = (CButton*)GetDlgItem(IDC_CHECK_BW); m_bBlackAndWhite = pButton->GetCheck(); }
BOOL CBusEventHandlerDlg::OnInitDialog() { CDialog::OnInitDialog(); CStringArray* pomStrArrayHandlerName = nullptr; CDialog::OnInitDialog(); if(m_eBus == LIN) { GetDlgItem(IDC_CHKB_BUSEV_PRECONNECT_HANDLER)->ShowWindow(TRUE); } if( m_pDoc != nullptr ) { CButton* pomButton = nullptr; CString omStrHandlerName = "" ; CString omStrControl = "" ; INT nCheck = 0; // get the pointer to CStringArray of error handlers prototypes pomStrArrayHandlerName = m_pDoc->pomStrGetBusEventHandlerPrototypes(); if(pomStrArrayHandlerName != nullptr ) { // Check for the handlers already added. for(INT i = 0; i<defBUSEV_HANDLER_NUMBER; i++) { for(INT j =0; j<pomStrArrayHandlerName->GetSize(); j++) { pomButton = (CButton*)GetDlgItem(IDC_CHKB_BUSEV_CONNECT_HANDLER+i); if(pomButton != nullptr ) { omStrHandlerName = pomStrArrayHandlerName->GetAt(j); pomButton->GetWindowText(omStrControl); omStrControl.Replace(' ','_'); omStrControl.Replace('-','_'); omStrControl = "OnBus_"+ omStrControl; // The find the control text in added handlers text if( omStrHandlerName.Find(omStrControl) != -1 ) { // If the dialog box is invoked for delete, check // the box of already added handlers else check and // disable if(m_bIsDelete == TRUE ) { pomButton->SetCheck(TRUE); } else { pomButton->SetCheck(TRUE); pomButton->EnableWindow(FALSE); } } } } } } // Disable all other check box corresponding to which the handlers // are not added and dialog box in invoked to delete the handlers if(m_bIsDelete == TRUE ) { for(INT i = 0; i<defBUSEV_HANDLER_NUMBER; i++) { pomButton = (CButton*)GetDlgItem(IDC_CHKB_BUSEV_CONNECT_HANDLER+i); if(pomButton != nullptr ) { nCheck = pomButton->GetCheck(); if(nCheck == 0 ) { pomButton->EnableWindow(FALSE); } } } // Set the dialog caption text to indicate user is deleting // the handlers SetWindowText(defBUSEV_HANDLER_TEXT_DEL); } else { // Set the dialog caption text to indicate user is adding // the handlers SetWindowText(defBUSEV_HANDLER_TEXT_ADD); } } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL COptions4Page::OnWizardFinish() { CWaitDlg wait; CFailDlg fail; CSuccessDlg success; HANDLE hThread; DWORD ThreadID, status = 0; CString FileName; CButton *pCheckOutput = (CButton *)GetDlgItem(IDC_CHECK_OUTFILE); CButton *pCheckError = (CButton *)GetDlgItem(IDC_CHECK_ERRFILE); CButton *pCheckOptions = (CButton *)GetDlgItem(IDC_CHECK_OPTFILE); CButton *pCheckSQL = (CButton *)GetDlgItem(IDC_CHECK_SQLFILE); Options4 = ""; if (pCheckOutput->GetCheck()) { GetDlgItemText(IDC_EDIT_OUTPUT_LOG, OutFile); if (OutFile == "") { Message.LoadString(IDS_NEED_OUTFILE); Message2.LoadString(IDS_TITLE); MessageBox(Message, Message2, MB_OK | MB_ICONEXCLAMATION); return 0; } Options4 += CString("-fl") + OutFile + CString(" "); } if (pCheckError->GetCheck()) { GetDlgItemText(IDC_EDIT_ERROR_LOG, ErrFile); if (ErrFile == "") { Message.LoadString(IDS_NEED_ERRFILE); Message2.LoadString(IDS_TITLE); MessageBox(Message, Message2, MB_OK | MB_ICONEXCLAMATION); return 0; } Options4 += CString("-fe") + ErrFile + CString(" "); } if (pCheckOptions->GetCheck()) { GetDlgItemText(IDC_EDIT_OPTIONS_LOG, FileName); if (FileName == "") { Message.LoadString(IDS_NEED_OPTFILE); Message2.LoadString(IDS_TITLE); MessageBox(Message, Message2, MB_OK | MB_ICONEXCLAMATION); return 0; } Options4 += CString("-fo") + FileName + CString(" "); } if (pCheckSQL->GetCheck()) { GetDlgItemText(IDC_EDIT_SQL_COPY, FileName); if (FileName == "") { Message.LoadString(IDS_NEED_SQLFILE); Message2.LoadString(IDS_TITLE); MessageBox(Message, Message2, MB_OK | MB_ICONEXCLAMATION); return 0; } Options4 += CString("-fc") + FileName + CString(" "); } hThread = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)ExecuteCommand, NULL, 0, &ThreadID); wait.DoModal(); while (WaitForSingleObject(hThread, 0) != WAIT_OBJECT_0); GetExitCodeThread(hThread, &status); if (status) { fail.DoModal(); return 0; } success.DoModal(); return CPropertyPage::OnWizardFinish(); }
bool xTerrainVegDlg::IsAddMode() { CButton * btn = (CButton *)GetDlgItem(IDC_TV_AddVeg); return btn->GetCheck() == BST_CHECKED; }