借着一个朋友要在安装包中启动Outlook的需求,写了一段代码,供有需要者参考。
这里先判断目标机是否安装了Office 2003 Outlook,之后启动。
具体代码如下:
 
function OnBegin()  
    
STRING svInstalledPath, szKeyRoot;
    
NUMBER nvSize, nType;
begin  
    
RegDBSetDefaultRoot HKEY_LOCAL_MACHINE ); 

    szKeyRoot 
= "SOFTWARE\\Microsoft\\Office\\11.0\\Outlook\\InstallRoot"
    nType 
= REGDB_STRING;
    
    
if (RegDBKeyExist (szKeyRoot) < 0then   
        
MessageBox ("RegDBKeyExist failed."SEVERE); 
    
else
        
if ( RegDBGetKeyValueEx (szKeyRoot, "Path", nType, svInstalledPath, nvSize) < 0 ) then
            
MessageBox ("RegDBGetKeyValueEx failed."SEVERE); 
        
else
            
LaunchAppAndWait(svInstalledPath + "Outlook.exe"""NOWAIT); 
        
endif;
    
endif;     
end
 
 
一点分享,在用RegDBGetKeyValueEx读取数据时,在给入的第三个参数中,我直接给了REGDB_STRING,结果编译报错(error C8046),只好先定义了一个NUMBER类型的变量nType,然后将nType给入才通过了编译。
 
更多Installshield技术交流问题,可查看Appinstall中文论坛(www.appinstall.cn)