📄 config.cpp
字号:
//---------------------------------------------------------------------------
// 学韬电子光盘册 版本: 1.0.2
// 作者:颜承 时间:2000.1.17
// 主要构件: TListView ,TTreeView ,TClientDataSet ,TList,TMemIniFile等
// API函数: GetVolumeInformation,ShellExecute GetDriveType GetLogicDriveStrings
// 自定义类: TSerchDisk 递归方法搜索整个磁盘目录文件结构
// 此为设置窗口实现文件
//---------------------------------------------------------------------------
// 版权所有(C)2000 颜 承
// 这一程序是自由软件,
// 你可以遵照自由软件基金会出版的GNU通用公共许可证条款来修改和重新发布这一程序。
// 发布这一程序的目的是希望它有用,但没有任何担保。甚至没有适合特定目的的隐含的担保。
// 更详细的情况请参阅GNU通用公共许可证。
// 你应该已经和程序一起收到一份GNU通用公共许可证的副本。
// 我的联系方式:桂林集琦药业股份有限公司技术部(541004)
// E-Mail: ycshowtop@sohu.com
//-------------------------------------------------------------------------------
#include <vcl.h>
#include <vcl/registry.hpp>
#pragma hdrstop
#include "config.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm6 *Form6;
//---------------------------------------------------------------------------
__fastcall TForm6::TForm6(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm6::btOkClick(TObject *Sender)
{
AnsiString temp,tmp;
int iCount,i;
temp=ExtractFileDir(Application->ExeName);
temp=temp+AnsiString("\\cdpack.ini");
TMemIniFile * Reg=new TMemIniFile(temp);
Reg->Clear();
iCount=ListBox1->Items->Count;
Reg->WriteInteger("Common","FilterCount",iCount);
Reg->WriteBool("Common","FileBind",cbBind->Checked);
Reg->WriteBool("Common","HtmlLink",cbLink->Checked);
for(i=0;i<iCount;i++) {
tmp=AnsiString("item")+AnsiString(i);
Reg->WriteString("Filter",tmp,ListBox1->Items->Strings[i]);
}
Reg->UpdateFile();
delete Reg;
TRegIniFile * Reg1 = new TRegIniFile("");
Reg1->RootKey=HKEY_CLASSES_ROOT;
if(cbBind->Checked==true) {
temp=Application->ExeName;
Reg1->CreateKey(".cdb");
Reg1->WriteString(".cdb","","光盘册文件");
Reg1->CreateKey("光盘册文件\\DefaultIcon");
Reg1->CreateKey("光盘册文件\\Shell\\open\\command");
Reg1->WriteString("光盘册文件\\Shell\\open\\command","",temp+AnsiString(" %1"));
Reg1->WriteString("光盘册文件\\DefaultIcon","",temp+AnsiString(" ,1"));
}
else {
Reg1->EraseSection(".cdb");
Reg1->EraseSection("光盘册文件");
}
delete Reg1;
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm6::FormCreate(TObject *Sender)
{
AnsiString tmp;
int iCount,i;
tmp=ExtractFileDir(Application->ExeName);
tmp=tmp+AnsiString("\\cdpack.ini");
TMemIniFile * Reg=new TMemIniFile(tmp);
if(Reg->SectionExists("Common") && Reg->SectionExists("Filter")) {
if(Reg->ValueExists("Common","FileBind"))
cbBind->Checked=Reg->ReadBool("Common","FileBind",false);
if(Reg->ValueExists("Common","HtmlLink"))
cbLink->Checked=Reg->ReadBool("Common","HtmlLink",false);
if(Reg->ValueExists("Common","FilterCount"))
iCount = Reg->ReadInteger("Common","FilterCount",3);
ListBox1->Clear();
for(i=0;i<iCount;i++) {
tmp=AnsiString("item")+AnsiString(i);
if(Reg->ValueExists("Filter",tmp))
ListBox1->Items->Add(Reg->ReadString("Filter",tmp,""));
}
ListBox1->ItemIndex=0;
}
else Application->MessageBox("错误的ini文件!","错误",MB_OK);
delete Reg;
}
//---------------------------------------------------------------------------
void __fastcall TForm6::Edit1Change(TObject *Sender)
{
if(Edit1->Text!="")btAdd->Enabled=true;
else btAdd->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm6::btAddClick(TObject *Sender)
{
if(ListBox1->Items->Count < 16)
ListBox1->Items->Add(Edit1->Text);
else Application->MessageBox("搜索文件类型不能超过16个!","提示",MB_OK);
}
//---------------------------------------------------------------------------
void __fastcall TForm6::btDelClick(TObject *Sender)
{
ListBox1->Items->Delete(ListBox1->ItemIndex);
}
//---------------------------------------------------------------------------
void __fastcall TForm6::btCancelClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -