[ Pobierz całość w formacie PDF ]
.";FileOpen->ShowHint = TRUE;FileSave->Hint = "Zapisz.";FileSave->ShowHint = TRUE;CopyText->Hint = "Kopiuj.";CopyText->ShowHint = TRUE;PasteText->Hint = "Wklej.";PasteText->ShowHint = TRUE;CutText->Hint = "Wytnij.";CutText->ShowHint = TRUE;CleanBuffers->Hint = "Wyczyœæ bufory.";CleanBuffers->ShowHint = TRUE;ReceiveFileSave->Hint = "Zapisz otrzymane.";ReceiveFileSave->ShowHint = TRUE;}//--------------------------------------------------------------------void __fastcall TForm1::FileOpenClick(TObject *Sender){CheckFileSave();if (OpenDialog1->Execute()){RichEdit1->Lines->LoadFromFile(OpenDialog1->FileName);RichEdit1->Modified = FALSE;RichEdit1->ReadOnly =OpenDialog1->Options.Contains(ofReadOnly);}}//--------------------------------------------------------------------void __fastcall TForm1::FileSaveClick(TObject *Sender){if (! strcmp(New_File.c_str(), LoadStr(256).c_str()))SaveAs1Click(Sender);else{RichEdit1->Lines->SaveToFile(New_File);RichEdit1->Modified = FALSE;}}//--------------------------------------------------------------------void __fastcall TForm1::CopyTextClick(TObject *Sender){RichEdit1->CopyToClipboard();}//--------------------------------------------------------------------void __fastcall TForm1::PasteTextClick(TObject *Sender){RichEdit1->PasteFromClipboard();}//--------------------------------------------------------------------void __fastcall TForm1::CutTextClick(TObject *Sender){RichEdit1->CutToClipboard();}//--------------------------------------------------------------------void __fastcall TForm1::UndoClick(TObject *Sender){if (RichEdit1->HandleAllocated())SendMessage(RichEdit1->Handle, EM_UNDO, 0, 0);}//--------------------------------------------------------------------void __fastcall TForm1::SelectAllClick(TObject *Sender){RichEdit1->SelectAll();}//--------------------------------------------------------------------void __fastcall TForm1::CleanBuffersClick(TObject *Sender){for (int i = 0; i Text = Buffer_I;}for (int i = 0; i Text = Buffer_O;}//memset(Buffer_O, 0, cbOutQueue);//memset(Buffer_I, 0, cbInQueue);ProgressBar1->Max = 0;}//--------------------------------------------------------------------void __fastcall TForm1::OpenCommClick(TObject *Sender){if (CheckBox1->Checked == TRUE) // wybór portulpFileName = "COM1";if (CheckBox2->Checked == TRUE)lpFileName = "COM2";hCommDev = CreateFile(lpFileName, GENERIC_READ | GENERIC_WRITE,0, NULL, OPEN_EXISTING, 0, NULL);if (hCommDev != INVALID_HANDLE_VALUE) // sprawdza, czy port jest// otwarty prawid³owo{SetupComm(hCommDev, cbInQueue, cbOutQueue);dcb.DCBlength = sizeof(dcb);GetCommState(hCommDev, &dcb);if (CheckBox3->Checked == TRUE) // wybór prêdkoœcidcb.BaudRate = CBR_1200;if (CheckBox4->Checked == TRUE)dcb.BaudRate = CBR_19200;dcb.Parity = ODDPARITY; // ustawienie parzystoœcidcb.StopBits = ONESTOPBIT; // bity stopudcb.ByteSize = 7; // bity danych//-przyk³adowe ustawienia flag steruj¹cych DCB-dcb.fParity = TRUE;dcb.fDtrControl = DTR_CONTROL_DISABLE;dcb.fRtsControl = RTS_CONTROL_DISABLE;dcb.fOutxCtsFlow = FALSE;dcb.fOutxDsrFlow = FALSE;dcb.fDsrSensitivity = FALSE;dcb.fAbortOnError = FALSE;dcb.fOutX = FALSE;dcb.fInX = FALSE;dcb.fErrorChar = FALSE;dcb.fNull = FALSE;dcb.EofChar = FALSE;SetCommState(hCommDev, &dcb);}else{switch ((int)hCommDev){case IE_BADID:MessageBox(NULL, "Niew³aœciwa nazwa portu lub port jest"" aktywny.", "B³¹d", MB_OK);break;};}}//--------------------------------------------------------------------void __fastcall TForm1::SendFileClick(TObject *Sender){DWORD FileSizeHigh;CheckComm->Enabled = FALSE;ProgressBar1->Max = 0;if ((_lopen(OpenDialog1->FileName.c_str(), OF_READ))!= HFILE_ERROR){hfile_s =_lopen(OpenDialog1->FileName
[ Pobierz całość w formacie PDF ]
Darmowy hosting zapewnia PRV.PL