InstallShield數據類型List-(數組)

InstallShield的腳本InstallScript中沒有數組,可以用List來實現。以下是List的一個實例:

function testList()

STRING svString;
LIST myList;
INT nResult;

begin
    //create a list
      myList=ListCreate(STRINGLIST);// orelse a NUMBERLIST

    //error check
    if (myList=LIST_NULL) then
       MessageBox("ListCreate error ",SEVERE);
       abort;
    endif;
   
    //List add string
     svString = "string1";
     if (ListAddString(myList,svString,AFTER)<0) then
        MessageBox("ListAddString error ",INFORMATION);
        abort;
     endif;
    
     svString = "string2";
     if (ListAddString(myList,svString,AFTER)<0) then
        MessageBox("ListAddString error ",INFORMATION);
        abort;
     endif;

     //read myList from first Item
     nResult=ListGetFirstString(myList,svString);

      //Loop all items
      while(nResult != END_OF_LIST)
         MessageBox(svString,INFORMATION);
         //find the next item
         nResult=ListGetNextString(myList,svString);
      endwhile;

      //destrpy myList
      ListDestroy(myList);

end;

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章