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;




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