본문 바로가기

Delphi

변수나 레코드 변수를 파일하나에서 관리하는 방법

변수 선언하기 /// 너무 기본적인 것이라  ㅠㅠ


기본 UNIT 생성하면 나오는 소스입니다.

unit Unit1;

interface

implementation

end.


여기에다

unit Unit1;

interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, ComCtrls,
  StdCtrls, Buttons, ADODB, Db,
  BubbleCh, Mask, imm, Grids, Chart, Series, ArrowCha;

const
  ch_SelfPLC_ID = $FF;
  ch_MnetPLC_ID = $0;
  ch_Terminater = $0;

  SMC = 4; 

  CODE = 7;

implementation

end.
 이런식으로 추가하시면 상수 변수도 등록하실수 있고

 

여기에다

unit Unit1;

interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, ComCtrls,
  StdCtrls, Buttons, ADODB, Db,
  BubbleCh, Mask, imm, Grids, Chart, Series, ArrowCha;

const
  ch_SelfPLC_ID = $FF;
  ch_MnetPLC_ID = $0;
  ch_Terminater = $0;

  SMC = 4;

  CODE = 7;

type
  Float     =  Single;
  PTFloat   = ^Single;
  PTSingle  = ^Single;
  TPByte    = ^Byte;

  T1ChnBuffType       =  Array[0..FFTSize - INX_MIN_NUM] of Single;  
  PT1ChnBuffType      =  ^T1ChnBuffType;

  TFrame = Record
    SMC             : String[SMC];
    CODE        : String[CODE];   

    RH           ,

    LH           : array[1..6] of string[7];//=  6;      

end;

implementation

end.

이런식으로 변수도 설정하고 RECORD도 선언하고

 

 

unit Unit1;

interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, ComCtrls,
  StdCtrls, Buttons, ADODB, Db,
  BubbleCh, Mask, imm, Grids, Chart, Series, ArrowCha;

const
  ch_SelfPLC_ID = $FF;
  ch_MnetPLC_ID = $0;
  ch_Terminater = $0;

  SMC = 4;

  CODE = 7;

type
  Float     =  Single;
  PTFloat   = ^Single;
  PTSingle  = ^Single;
  TPByte    = ^Byte;

  T1ChnBuffType       =  Array[0..FFTSize - INX_MIN_NUM] of Single;  
  PT1ChnBuffType      =  ^T1ChnBuffType;

  TFFrame = Record
    SMC             : String[SMC];
    CODE        : String[CODE];   

    RH           ,

    LH           : array[1..6] of string[7];//=  6;      

end;

 

var
 FFrame : TFFrame;  //레코더 상속

 bTimerLogPass_DAQ : Boolean;
  bFunPass, bFormActivPass  : Boolean;

implementation

end.

이런식으로 변수도 선언하고 레코드 상속받고

 

 

메인폼에 가서  

unit UFM_Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UNIT1;

USES 절에 추가해서 사용하시면 변수 추가나 수정시 UNIT1 파일안에서만 수정,추가하시면

프로그램 안에서 사용 가능합니다.