我是初学者![em45]
void __fastcall TForm1::Button1Click(TObject *Sender) { char buff[60]; unsigned long nn; nn=60; GetComputerName(buff,&nn); Edit1->Text=buff; } //---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender) { if(SetComputerName(Edit1->Text.c_str())) { ShowMessage("需重启计算机设置才生效!"); } } //---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender) { TRegistry *rg; // rg=new TRegistry(); rg->RootKey=HKEY_LOCAL_MACHINE;
rg->OpenKey("\\SYSTEM\\ControlSet001\\Services\\Tcpip\\Parameters\\Interfaces\\{94BC1360-7F56-4E1E-9FC1-BCF37AF51252}",False); Edit2->Text=rg->ReadString("DhcpDomain");
// rg->CloseKey(); rg->Free(); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button4Click(TObject *Sender) { TRegistry *rg; // rg=new TRegistry(); rg->RootKey=HKEY_LOCAL_MACHINE;
rg->OpenKey("\\SYSTEM\\ControlSet001\\Services\\{94BC1360-7F56-4E1E-9FC1-BCF37AF51252}\\Parameters\\Tcpip",False); Edit3->Text=rg->ReadString("DhcpIPAddress"); // rg->CloseKey(); rg->Free(); } 程序是这样,但是为什么在我的机子还是就可以,在别人的机上就不得呢?