1. 程式人生 > >installshield 2010之 安裝包安裝和解除安裝過程中如何註冊和反註冊dll或者ocx

installshield 2010之 安裝包安裝和解除安裝過程中如何註冊和反註冊dll或者ocx

1, 選擇behavior  and logic->InstallScript

2,   然後右側選中對應的feature, 然後在旁邊的下來框中選擇installed 和uninstalled

3.   分別再installed和uninstalled函式中添加註冊相關程式碼

export prototype DefaultFeature_UnInstalled();
function DefaultFeature_UnInstalled()   

string svPath;  
begin 
svPath = TARGETDIR ^ "mytest.dll";           

//LongPathToShortPath ( svPath );   
if (LaunchAppAndWait ("regsvr32"," -s /u"+ " \"" + svPath + "\"", WAIT)< 0) then
    MessageBox("解除安裝OCX失敗", SEVERE);    
      abort;
endif; 
end;
//---------------------------------------------------------------------------
// The Installed event is sent after the feature NewFeature1
// is installed.
//---------------------------------------------------------------------------
 
export prototype NewFeature1_Installed();
function NewFeature1_Installed() 
string svPath;
begin                      
svPath = TARGETDIR ^ "\\mytest.dll";           
if (LaunchAppAndWait ("regsvr32"," -s /u"+ " \"" + svPath + "\"", WAIT)< 0) then
    MessageBox("註冊檔案自動註冊失敗", SEVERE);    
      abort;
endif;   
if (LaunchAppAndWait ("regsvr32"," -s "+ " \"" + svPath + "\"", WAIT)< 0) then
   
MessageBox("註冊檔案自動註冊失敗", SEVERE);    
      abort;
endif;  

end;