Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Progressbar weiterschalten


1 reply to this topic

Richard Schuster

Richard Schuster
  • Members
  • 6 posts

Posted 19 March 2001 - 13:41

Hallo, ich habe das Problem, dass ich in meinen CAs den Progressbar weiterschalten möchte. Dazu habe ich das Beispiel aus der SDK-Doku hergenommen und folgender weise in meine CAs implementiert:
function CAMigrationPassOneInitProgress(hMSI)  
   // To Do:  Declare local variables.
   STRING  FunctionName;
   HWND    ObRecordHandle;
   NUMBER  RetCode, CtTicks;
begin            
   // To Do:  Write script that will be executed when MyFunction is called.
   FunctionName = "CAMigrationPassOneInitProgress";
#ifdef DEBUG    
   MessageBox(FunctionName,INFORMATION);
#endif
   CtTicks = SAT_MIGRATION_PASS_ONE_TICKS;
   ObRecordHandle = MsiCreateRecord(3);
   MsiRecordSetInteger(ObRecordHandle,1,3);        // ProgressAddition subclass
   MsiRecordSetInteger(ObRecordHandle,2,CtTicks);  // Add the ticks to the current progress total
   RetCode = MsiProcessMessage(hMSI,INSTALLMESSAGE_PROGRESS,ObRecordHandle);
   return ERROR_SUCCESS;
end;

Diese CA wird in der "Ausführen" Sequenz nach "ProcessComponents" sofort ausgeführt.

Danach wird die folgende CA verzögert ausgeführt. Diese CA verrichtet die eigentliche Arbeit.

function CAMigrationMoveDatabase(hMSI)  
   // To Do:  Declare local variables.
   STRING  StFunctionName, StError, StPath, StTBIIInstallationPath;
   STRING  StProgramPath, StProgramName, StOldInstallationPath;
   STRING  StParameter, StExecutable, StRetCode, StTBIIInstallationDisk;
   STRING  StOldInstallationDisk, StDatabaseFolder, StRegKey;
   NUMBER  RetCode, Type, Size, iTotalTicks, iTickIncrement;
   HWND    hRec, hProgressRec;
begin            
   // To Do:  Write script that will be executed when MyFunction is called.
   StFunctionName = "CAMigrationMoveDatabase";
#ifdef DEBUG    
   MessageBox(StFunctionName,INFORMATION);
#endif
   iTotalTicks = 100;
   hRec = MsiCreateRecord(3);
   hProgressRec = MsiCreateRecord(3);

   MsiRecordSetString(hRec,1,"MigrationMoveDatabase");
   MsiRecordSetString(hRec,2,@SAT_MSG_MIGRATION_MOVE_DATABASE);
   MsiRecordSetString(hRec,3,@SAT_MSG_PROGRESS_STEP);
   RetCode = MsiProcessMessage(hMSI,INSTALLMESSAGE_ACTIONSTART,hRec);

   // Tell the installer to use explicit progress messages.

   MsiRecordSetInteger(hRec,1,1);
   MsiRecordSetInteger(hRec,2,1);
   MsiRecordSetInteger(hRec,3,0);
   RetCode = MsiProcessMessage(hMSI,INSTALLMESSAGE_PROGRESS,hRec);

   // Specify that an update of the progress bar's position in this
   // case means to move it forward by one increment.
   
   iTickIncrement = 1;
   MsiRecordSetInteger(hProgressRec,1,2);
   MsiRecordSetInteger(hProgressRec,2,iTickIncrement);
   MsiRecordSetInteger(hProgressRec,3,0);

   // The following loop sets up the record needed by the progress
   // messages and tells the installer to send a message to update
   // the progress bar.

   MsiRecordSetInteger(hRec,2,iTotalTicks);

   MsiRecordSetInteger(hRec,1,1);
   RetCode = MsiProcessMessage(hMSI,INSTALLMESSAGE_ACTIONDATA,hRec);
   RetCode = MsiProcessMessage(hMSI,INSTALLMESSAGE_PROGRESS,hProgressRec);

.....
Code, der Aktionen ausführt
.....
   MsiRecordSetInteger(hRec,1,Tick);
   RetCode = MsiProcessMessage(hMSI,INSTALLMESSAGE_ACTIONDATA,hRec);
   RetCode = MsiProcessMessage(hMSI,INSTALLMESSAGE_PROGRESS,hProgressRec);


Das Problem ist nun, dass sich der Progressbar nicht ändert.

Was mache ich falsch?

Schöne Grüße,
Richard Schuster

VA TECH SAT GmbH & Co
Ruthnergasse 1
A-1210 Wien, Austria

Telefon: (+43/1) 29129 4611
Fax: (+43/1) 29 28 838
e-mail: mailto:schu@sat-automation.com
Internet: http://www.sat-automation.com/