Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 Q&A
Delphi Programming Q&A
[2904] [정보] 함수실행시 형태 다른 인자 인식 예제..
grcsb [ ] 1352 읽음    1998-05-21 01:55
함수를 실행하려는데..
인자의 형태가 정해져 있지 않는 경우 아래를 참고하세요..

From 류..

---------

Function DoWithVarType(a:Variant):String;
begin
  Case VarType(a) of
       varEmpty : Result:= 'The variant is Unassigned.';
       varNull : Result:= 'The variant is Null.';
       varSmallint :  Result:= '16-bit signed integer (type Smallint).';
       varInteger : Result:= '32-bit signed integer (type Integer).';
       varSingle : Result:= 'Single-precision floating-point value (type Single).';
       varDouble : Result:= 'Double-precision floating-point value (type Double).';
       varCurrency : Result:= 'Currency floating-point value (type Currency).';
       varDate : Result:= 'Date and time value (type TDateTime).';

       varOleStr : Result:= 'Reference to an OLE string (a dynamically allocated Unicode string).';
       varDispatch : Result:= 'Reference to an OLE automation object (an IDispatch interface pointer).';
       varError : Result:= 'Operating system error code.';
       varBoolean : Result:= '16-bit Boolean (type WordBool).';
       varVariant : Result:= 'Variant (used only with variant arrays).';
       varUnknown : Result:= 'Reference to an unknown OLE object (an IUnknown interface pointer).';
       varByte : Result:= '8-bit unsigned integer (type Byte).';

       varString : Result:= 'Reference to a dynamically allocated long string (type AnsiString).';
       varTypeMask : Result:= 'Bit mask for extracting type code.';
       varArray : Result:= 'Bit indicating variant array.';
       Else Result:= 'Reference to an unknown OLE object (an IUnknown interface pointer).';
  End;
end;

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage(DoWithVarType('Hello'));
  ShowMessage(DoWithVarType(1));
  ShowMessage(DoWithVarType(1.0));
end;



+ -

관련 글 리스트
2904 [정보] 함수실행시 형태 다른 인자 인식 예제.. grcsb 1352 1998/05/21
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.