#include <vcl.h>
#pragma hdrstop
#include <Registry.hpp>
#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)
{
//读注册表
TRegistry *RegLiveFpcnR = new TRegistry;
try
{
RegLiveFpcnR->RootKey = HKEY_LOCAL_MACHINE;
if(RegLiveFpcnR->OpenKey("\\SOFTWARE\\ORACLE",true) != false)
CSpinEdit1->Text = RegLiveFpcnR->ReadString("NL2005-2-28_FORMAT");
}
__finally
{
RegLiveFpcnR->CloseKey();
delete RegLiveFpcnR;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
//写注册表
TRegistry *RegLiveFpcnW = new TRegistry;
try
{
RegLiveFpcnW->RootKey = HKEY_LOCAL_MACHINE;
if(RegLiveFpcnW->OpenKey("\\SOFTWARE\\ORACLE",true) != false)
RegLiveFpcnW->WriteString("NL2005-2-28_FORMAT",Trim(CSpinEdit2->Text.c_str()));
ShowMessage("日期格式设置成功!");
}
__finally
{
RegLiveFpcnW->CloseKey();
delete RegLiveFpcnW;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
CSpinEdit2->Items->Add("YYYY-MM-DD");
CSpinEdit2->Items->Add("YYYY/MM/DD");
CSpinEdit2->Items->Add("MM-DD-YYYY");
CSpinEdit2->Items->Add("MM/DD/YYYY");
CSpinEdit2->Items->Add("MM-DD-YY");
CSpinEdit2->Items->Add("MM/DD/YY");
CSpinEdit2->Items->Add("DD-MM-YYYY");
CSpinEdit2->Items->Add("DD/MM/YYYY");
CSpinEdit2->Items->Add("DD-MM-YY");
CSpinEdit2->Items->Add("DD/MM/YY");
Label3->Caption="本程序是针对Oracle日期格式更改而设计的,\n设计环境:Windows98/Oracle7 \n适用于客户端和单机版用户。建立或修改注册表键值:";
}
//---------------------------------------------------------------------------
本文地址:http://com.8s8s.com/it/it5571.htm