카테고리 없음

인스톨쉴드 사용

MasterJ 2011. 6. 9. 19:58

사용자 함수 추가

 

스크립트에 함수를 추가 하기 위해서는 prototype을 정의 하고

function body를 작성합니다.

 

//프로토 타입 정의

protype GetPathParts(STRING, BYREF STRING, BYREF STRING, BYREF STRING);

 

//function block 작성

function GetPathParts(szFullPath, svDrv, svPath, svName)
    LONG lResult;   //사용할 변수를 정의 합니다.
begin // 함수의 실제 내용 시작
    lResult = ParsePath(svDrv, szFullPath, DISK);
    if (lResult = 0) then
        lResult = ParsePath(svPath, szFullPath, DIRECTORY);
    endif;

    if (lResult = 0) then
        lResult = ParsePath(svName, szFullPath, FILENAME);
    endif;

    return lResult; 
end; //함수의 끝

 

리턴값은 주로 함수의 에러값을 리턴하며, 숫자값이 아니거나 여러개일경우 함수에 넘겨주는 변수 값을 BYREF 를 이용해서 정의 합니다.(

 

즉 기본적으로 인스톨쉴드는 By Value방식으로 값을 전달 합니다

////////////////////////////////////////////////////////////////////////

 

정의방법

// Constant definitions
#define PRODUCT "InstallShield"
#define LIMIT    100

// Variable declarations
CHAR  cVal;
NUMBER nVal;
STRING szName;
    
// Function declarations
prototype DisplayMsg (NUMBER, STRING);
prototype GetName (BYREF STRING);

 

////////////////////////////////////////////////////////////////////////

 

Data Type

 

여러가지 데이타 타입이 있는데 세가지만 설명합니다.

 

숫자 데이타는 NUMBER

문자데이터는 STRING

리스트데이터는 LIST

 

가장 많이 쓰는 데이타 타입입니다. 나머지 타입은 Help를 참조해주시기 바랍니다.

 

 

//////////////////////////////////////////////////////////////////////

기타 많이 쓰는 문법구문(예제는 Help에서 가져왔습니다.)

 

IF문

if (condition) then
    // statements to be executed if condition is true
endif;

 

FOR문

for iCount = 1 to 10
        MessageBox ("This appears ten times.", INFORMATION);
    endfor;
for iCount = 10 to 100 step 10
        MessageBox ("This appears ten times.", INFORMATION);
    endfor;

 

WHILE문
nCount = 1;

    while (nCount < 5)
        MessageBox ("This is still true.", INFORMATION);
        nCount = nCount + 1;
    endwhile;

 

SWITCH문
STRING szMsg, svResult;
    NUMBER nvResult;

    GetSystemInfo (VIDEO, nvResult, svResult);
   
    switch (nvResult)
        case IS_UNKNOWN:
            szMsg = "The user's video is unknown.";
        case IS_EGA:
            szMsg = "EGA resolution.";
        case IS_VGA:
            szMsg = "VGA resolution.";
        case IS_SVGA:
            szMsg = "Super VGA (800 x 600) resolution.";
        case IS_XVGA:
            szMsg = "XVGA (1024 x 768) resolution.";
        case IS_UVGA:
            szMsg = "Greater than 1024 x 768 resolution.";
        default:
            szMsg = "Error";
    endswitch;

    MessageBox (szMsg, INFORMATION);