🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: cn.bbs.comp.program
2 messages
2 total messages Started by �����п� Sun, 01 Feb 1998 00:00
c++ builder help!
#2087
Author: �����п�
Date: Sun, 01 Feb 1998 00:00
4 lines
653 bytes
�м�����������̸�λ������
1��c++ builder �����ʹij�����ڳ�Ϊ����ģʽ�Ի�����
2��ʲô����ɸ㶨ע���
Re: c++ builder help!
#2089
Author: �����п�
Date: Sun, 01 Feb 1998 00:00
127 lines
4845 bytes
I have done it myself!

>1��c++ builder �����ʹij�����ڳ�Ϊ����ģʽ�Ի�����

--->  ShowModel();


>2��ʲô����ɸ㶨ע���

//***********************************************
// Written by Mr. Michael Jia   1998-01-31
//***********************************************
#include <vcl\vcl.h>
#include <vcl\registry.hpp>
#pragma hdrstop
#include "testr.h"
//--------------------------------------------------------------------------
-
#pragma resource "*.dfm"
TForm1 *Form1;
AnsiString path,font,color;
//--------------------------------------------------------------------------
-
__fastcall TForm1::TForm1(TComponent* Owner)
 : TForm(Owner)
{
}
//--------------------------------------------------------------------------
-
void __fastcall TForm1::exitClick(TObject *Sender)
{
Close();
}
//--------------------------------------------------------------------------
-
void __fastcall TForm1::saveClick(TObject *Sender)
{  TRegistry *regtable ;
    regtable=new (TRegistry);
    /*************************************************************
     1.Install Soft  must be put here:
       HKEY_LOCAL_MACHINE\Software\yourCompany\yourrProduct\ver1.0
     2.If your software support ole must be put here:
       HKEY_LOCAL_MACHINE\Software\Classes
     3.Data you use must be put here:
       HKEY_CURRENT_USER\Software\MyCompany\MyProduct\1.0\...
     <<my sample is
        HKEY_CURRENT_USER\Software\MichaelJia
           Path
           Font
           Color
     >>
      Notice: CreateKey(OpenKey) & CloseKey must be pair.
    **************************************************************/
    if (regtable->OpenKey("Software",false)==true)  //change RootKey
    {regtable->RootKey=regtable->CurrentKey;
     //Now RootKey is HKEY_LOCAL_MACHINE\Software
     regtable->CloseKey();
    }
    else {MessageBox(0,"Change RootKey Error!!!","message",MB_OK);
          return ;
         }
  if(regtable->OpenKey( "MichaelJia",false)==true)  //save
     {regtable->WriteString("Path",path->Text);
      regtable->WriteString("Font",font->Text);
      regtable->WriteString("Color",color->Text);
      regtable->CloseKey();
     }
  else{
       if( regtable->CreateKey("MichaelJia")==true)
          {//if the first time just create the KEY
          regtable->CloseKey();   //after you create it ,you must close it
                                  //for reopenning to write    !!!!!
          MessageBox(0,"First time ,MichaelJia created!","message",MB_OK);
           //set default values
          regtable->OpenKey("MichaelJia",false);
          regtable->WriteString("Path","Hello,World");
          regtable->WriteString("Font","C++ Builder");
          regtable->WriteString("Color","My name is Michael Jia");
          regtable->CloseKey();
          }
        else
          {MessageBox(0,"Write error,other program locks the
Registry","message",MB_OK);
          }
     };
 // regtable->CloseKey();   //close registry table
}
//--------------------------------------------------------------------------
-
void __fastcall TForm1::loadClick(TObject *Sender)
{
 TRegistry *regtable ;
    regtable=new (TRegistry);
    if (regtable->OpenKey("Software",false)==true)  //change RootKey
    {regtable->RootKey=regtable->CurrentKey;
     //Now RootKey is HKEY_LOCAL_MACHINE\Software
      regtable->CloseKey();
    }
    else {MessageBox(0,"Change RootKey Error!!!","message",MB_OK);
          return ;
         }
  if(regtable->OpenKey( "MichaelJia",false)==true)  //save
     {
      path->Text=regtable->ReadString("Path");
      font->Text=regtable->ReadString("Font");
      color->Text=regtable->ReadString("Color");
      regtable->CloseKey();
     }
  else {
 MessageBox(0,"Read error!!! \nMaybe other program locks the Registry or you
don't save it first!","message",MB_OK);
           };
  //regtable->CloseKey();   //close registry table

}
//--------------------------------------------------------------------------
-
void __fastcall TForm1::changeClick(TObject *Sender)
{ AnsiString saves;
saves=path->Text;
path->Text=font->Text;
font->Text=color->Text;
color->Text=saves;
}
//--------------------------------------------------------------------------
-
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads