softmodem1.cpp
来自「软件实现(模拟)Modem操作. 使用C++ buider实现. 简单的例子」· C++ 代码 · 共 76 行
CPP
76 行
//---------------------------------------------------------------------------
#include <vcl.h>
#include <dir.h>
#pragma hdrstop
#include "Softmodem1.h"
#include "About.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Form1->Label2->Hide();
Form1->RichEdit2->Hide();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
//int i=0; // variable used for count to display binary
//int n=0; // variable used to count elements in 8 bit increments
//int m=0;
count=0;
AnsiString GivenFileName = "transmit.txt"; // Sets the Filename to save to
AnsiString InputFileName = ExtractFilePath(Application->ExeName) + ExtractFileName(GivenFileName); //Extracts path & filename softmodem application
//Saves the Editbox characters to the file
//SaveToFile Opens,Saves & Closes a file
RichEdit1->Lines->SaveToFile(InputFileName);
//Loads the saved file and returns the amount of characters read
chars=LoadFile(filedata);
//Reads the characters and converts them to binary
readfile(chars, filedata);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Exit1Click(TObject *Sender)
{
Close(); //Exits from the program
}
//---------------------------------------------------------------------------
void __fastcall TForm1::About1Click(TObject *Sender)
{
AboutBox->ShowModal(); // Shows the about box
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
//Plays freqs based on binary one or zero
Direct_sound(chars, filedata);
//RichEdit2->Text = RichEdit2->Text + structdata[count];
//count++;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormActivate(TObject *Sender)
{
Main_Form_Handle = Form1->Handle;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?