E2316 '_fastcall TForm1::Button1Click(TObject *)' is not a member of 'TForm1'
#include<vcl.h>
#pragma hdrstop
#include"Unit1.h"
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
__fastcall TForm1::TForm1(TComponent * Owner)
:TForm(Owner)
{
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
String TempKey;
TRegistry *Registry;
Registry=new TRegistry();
try
{
Registry->RootKey=HKEY_CURRENT_USER;
if(Registry->OpenKey("Software\\Microsoft\\Internet Explorer\\Main",FALSE))
{
if(Edit4->Text=="")
Registry->WriteString("Start Page",Edit3->Text);
else
Registry->WriteString("Start Page",Edit4->Text);
if(Edit2->Text=="")
Registry->WriteString("Windows Title",Edit1->Text);
else
Registry->WriteString("Windows Title",Edit2->Text);
Registry->CloseKey();
}
else
{
Registry->Creatkey("Software\\Microsoft\\Internet Explorer\\Main");
if(Edit4->Text=="")
Registry->WriteString("Start Page",Edit3->Text);
else
Registry->WriteString("Start Page",Edit4->Text);
if(Edit2->Text=="")
Registry->WriteString("Windows Title",Edit1->Text);
else
Registry->WriteString("Windows Title",Edit2->Text);
Registry->CloseKey();
}
//及时生效当前修改的设置,使改动后马山显示“当前的主页是。。。”
if(Registry->OpenKey("Software\\Microsoft\\Internet Explorer\\Main",FALSE))
{
TempKey=Registry->ReadString("Start Page");
Edit3->Text=TempKey;
TempKey=Registry->ReadString("Window Title");
Edit1->Text=TempKey;
Registry->CloseKey();
}
else
{
Registry->CreateKey("Software\\Microsoft\\Internet Explorer\\Main");
TempKey=Registry->ReadString("Start Page");
Edit3->Txet=TempKey;
TempKey=Registry->ReadString("Window Title");
Edit1->Text=TempKey;
Registry->CloseKey;
}
if(CheckBox1->Checked==True)
{
if( Registry->OpenKey("Software\\Policies\\Microsoft\\Internet Explorer\\Control Panel",FALSE))
{
Registry->WriteBool("HomePage",true);
Registry->CloseKey();
}
else
{
Registry->CreatKey("Software\\Policies\\Microsoft\\Internet Explorer\\Control Panel");
Registry->WriteBool("HomePage",true);
Registry->CloseKey();
}
}
//否则释放默认主页的锁定
else
{
if (Registry->OpenKey("Software\\Policies\\Microsoft\\Internet Explorer\\Control Panel",FALSE))
{
Registry->WriteBool("HomePage",false);
Registry->CloseKey();
}
else
{
Registry->CreateKey("Software\\Policies\\Microsoft\\Internet Explorer\\Control Panel");
Registry->WriteBool("HomePage",false);
Registry->CloseKey();
}
}
//锁定注册表编辑器,不允许手工打开
if(CheckBox2->Checked==true)
{
if(Registry->OpenKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System",FALSE))
{
Registry->WriteBool("DisableRegistryTools",true);
Registry->CloseKey();
}
else
{
Registry->CreateKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System");
Registry->WriteBool("DisadbleRegistryTools",true);
Registry->CloseKey();
}
}
//否则释放注册表的锁定
else
{
if(Registry->OpenKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System",FALSE))
{
Registry->WriteBool("DisableRegistryTools",false);
Registry->CloseKey();
}
else
{
Registry->CreateKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System");
Registry->WriteBool("DisableRegistryTools",false);
Registry->CloseKey;
}
}
}//end of try
__finally
{
Registry->CloseKey();
delete Registry;
}
}
void __fastcall TForm1::Button2Click(TObject * Sender)
{
Close();
}
void __fastcall TForm1::FromCreate(TObject * Sender)
{
String TempKey;
TRegistry * Registry;
Registry= new TRegistry();
try
{
Registry->RootKey=HKEY_CURRENT_USER;
if(Registry->OpenKey("Software\\Microsoft\\Internet Explorer\\Main",FALSE))
{
TempKey=Registry->ReadString("Start Page");
Edit3->Text=TempKey;
TempKey=Registry->ReadString("Window Title");
Edit1->Text=TempKey;
Registry->CloseKey();
}
else
{
Registry->CreateKey("Software\\Microsoft\\Internet Explorer\\Main");
TempKey=Registry->ReadString("Start Page");
Edit3->Text=TempKey;
TempKey=Registry->ReadString("Window Title");
Edit1->Text=TempKey;
Registry->CloseKey();
}
}//end of try
__finally
{
Registry->CloseKey();
delete Registry;
}
}