Installshield 实现文件关联的脚本
来源:互联网 发布:加勒比海盗知乎 编辑:程序博客网 时间:2024/05/17 05:52
Installshield 2010 Install scrpit msi工程
最近比较蛋疼的事情是打安装包的时候,需求是最后给个chechbox供用户选择是否文件关联apk,翻阅了文件关联修改注册表,有点眉目但是没有实现功能,具体代码如下:
//设置是否关联apk,从而写注册表 export prototype ExFn_RegDBAccationKeyValueEx(); function ExFn_RegDBAccationKeyValueEx() STRING szKey, szNumName, szNumValue, svNumValue,svNumValue1,svNumValue2,svNumValue3, szTitle, szMsg,szNumName1, szNumValue1,szNumName2, szNumValue2,szNumName3, szNumValue3; NUMBER nType, nSize, nvType, nvSize; STRING szNumName4,szNumValue4,svNumValue4,szProgidKey,szNumName5,szNumValue5,svNumValue5;begin // Create a key to test. RegDBSetDefaultRoot(HKEY_CLASSES_ROOT); szKey = "MSApkInstaller\\"; if (RegDBCreateKeyEx (szKey, "") < 0) then MessageBox ("RegDBCreateKeyEx failed.", SEVERE); endif; // Set up parameters for call to RegDBSetKeyValueEx. szNumName = ""; szNumValue = TARGETDIR^"\\Resources\\logo\\MSAPK.ico,0"; nType = REGDB_STRING; nSize = -1; szNumName1 = ""; szNumValue1= "open"; szNumName2 = ""; szNumValue2= "Mobfound APk安装程序"; szNumName3 = ""; szNumValue3= "\""+TARGETDIR^"\\msApkTool.exe\" -path=\"%1\""; szKey = "MSApkInstaller\\DefaultIcon\\"; // Retrieve key value information. if (RegDBGetKeyValueEx (szKey, szNumName, nvType, svNumValue,nvSize) < 0) then // Set a key name and a value associated with it. if (RegDBSetKeyValueEx (szKey, szNumName, nType, szNumValue,nSize) < 0) then MessageBox ("RegDBSetKeyValueEx failed.", SEVERE); else // Display what RegDBSetKeyValueEx has done. endif; endif; //we should check the key1 value1 information szKey = "MSApkInstaller\\shell\\"; if (RegDBGetKeyValueEx (szKey, szNumName1, nvType, svNumValue1,nvSize) < 0) then // Set a key name and a value associated with it. if (RegDBSetKeyValueEx (szKey, szNumName1, nType, szNumValue1,nSize) < 0) then MessageBox ("RegDBSetKeyValueEx failed1.", SEVERE); else // Display what RegDBSetKeyValueEx has done. endif; endif; //we should check the key2 value2 information szKey = "MSApkInstaller\\shell\\open\\"; if (RegDBGetKeyValueEx (szKey, szNumName2, nvType, svNumValue2,nvSize) < 0) then // Set a key name and a value associated with it. if (RegDBSetKeyValueEx (szKey, szNumName2, nType, szNumValue2,nSize) < 0) then MessageBox ("RegDBSetKeyValueEx failed2.", SEVERE); else // Display what RegDBSetKeyValueEx has done. endif; endif; //we should check the key3 value3 information szKey = "MSApkInstaller\\shell\\open\\command\\"; if (RegDBGetKeyValueEx (szKey, szNumName3, nvType, svNumValue3,nvSize) < 0) then // Set a key name and a value associated with it. if (RegDBSetKeyValueEx (szKey, szNumName3, nType, szNumValue3,nSize) < 0) then MessageBox ("RegDBSetKeyValueEx failed3.", SEVERE); else // Display what RegDBSetKeyValueEx has done. endif; endif; szKey = ".apk\\"; szNumName5 = "."; szNumValue5 = "MSApkInstaller"; if (RegDBGetKeyValueEx (szKey, szNumName5, nvType, svNumValue5,nvSize) < 0) then // Set a key name and a value associated with it. if (RegDBSetKeyValueEx (szKey, szNumName5, nType, szNumValue5,nSize) < 0) then MessageBox ("RegDBSetKeyValueEx failed5.", SEVERE); else // Display what RegDBSetKeyValueEx has done. endif; endif; RegDBSetDefaultRoot(HKEY_CURRENT_USER); szProgidKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.apk\\"; szNumName4 = "Progid"; szNumValue4 = "MSApkInstaller"; if (RegDBGetKeyValueEx (szProgidKey, szNumName4, nvType, svNumValue4,nvSize) < 0) then // Set a key name and a value associated with it. if (RegDBSetKeyValueEx (szProgidKey, szNumName4, nType, szNumValue4,nSize) < 0) then MessageBox ("RegDBSetKeyValueEx failed4.", SEVERE); else // Display what RegDBSetKeyValueEx has done. endif; endif; //OpenWithList RegDBSetDefaultRoot(HKEY_CURRENT_USER); szProgidKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.apk\\OpenWithList\\"; szNumName4 = "."; szNumValue4 = "MSApkInstaller"; if (RegDBGetKeyValueEx (szProgidKey, szNumName4, nvType, svNumValue4,nvSize) < 0) then // Set a key name and a value associated with it. if (RegDBSetKeyValueEx (szProgidKey, szNumName4, nType, szNumValue4,nSize) < 0) then MessageBox ("RegDBSetKeyValueEx OpenWithList.", SEVERE); else // Display what RegDBSetKeyValueEx has done. endif; endif; InvalidateRect( 0, NULL,TRUE); end; //删除关联apk,从而删除注册表对应的内容 export prototype ExFn_RegDBDeltKeyValueEx(); function ExFn_RegDBDeltKeyValueEx() STRING szKey,szSubValue; NUMBER nType, nSize, nvType, nvSize; begin // Delete a key to MSApkInstaller. RegDBSetDefaultRoot(HKEY_CLASSES_ROOT); szKey = "MSApkInstaller\\"; if (RegDBDeleteKey (szKey) < 0) then //MessageBox ("RegDBDeleteKey apk failed.", SEVERE); endif; RegDBSetDefaultRoot(HKEY_CURRENT_USER); szKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.apk\\"; if (RegDBDeleteKey (szKey) < 0) then //MessageBox ("RegDBDeleteKey apk failed.", SEVERE); endif; InvalidateRect( 0, NULL,TRUE); end; //注册安装程序export prototype ExFn_RegDBInstalltKeyValueEx(); function ExFn_RegDBInstalltKeyValueEx() STRING szKey, szNumName, szNumValue, svNumValue,szNumName1, szNumValue1,svNumValue1,szTitle, szMsg; NUMBER nType, nSize, nvType, nvSize; begin //Install key to MS szNumName = ""; szNumValue = TARGETDIR^"\\ms\\MS.exe"; szNumName1 = "Path"; szNumValue1 = TARGETDIR^"\\ms"; nType = REGDB_STRING; nSize = -1; RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); szKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\MS.exe"; if (RegDBKeyExist(szKey) == 1) then //MessageBox ("RegDBKeyExis ", SEVERE); else if (RegDBSetKeyValueEx (szKey, szNumName, nType, szNumValue,nSize) < 0) // Set a key name and a value associated with it. then MessageBox ("RegDBSetKeyValueEx ms.exe failed.", SEVERE); endif; endif; if (RegDBKeyExist(szKey) == 1) then //MessageBox ("RegDBKeyExis ", SEVERE); else if (RegDBSetKeyValueEx (szKey, szNumName1, nType, szNumValue1,nSize) < 0) // Set a key name and a value associated with it. then MessageBox ("RegDBSetKeyValueEx path failed.", SEVERE); endif; endif; end; //卸载安装程序export prototype ExFn_RegDBUnInstalltKeyValueEx(); function ExFn_RegDBUnInstalltKeyValueEx() STRING szKey, szNumName, szNumValue, svNumValue, szTitle, szMsg; NUMBER nType, nSize, nvType, nvSize; begin //Install key to MS szNumName = ""; szNumValue = TARGETDIR^"\\MS.exe"; nType = REGDB_STRING; nSize = -1; RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); szKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\MS.exe"; if (RegDBKeyExist(szKey) == 1) then MessageBox("RegDBKeyExist", SEVERE); endif; // Set a key name and a value associated with it. if (RegDBDeleteKey (szKey) < 0) then //MessageBox ("RegDBDeleteKey uninstall failed.", SEVERE); endif; end;出现的错误,请各位指正
- Installshield 实现文件关联的脚本
- 用InstallShield实现ini文件的操作
- installshield 如何实现Oracle数据库脚本的执行功能
- Installshield 关于SQL的脚本
- Installshield脚本拷贝文件常见问题汇总
- installshield脚本实现windows服务安装
- InstallShield: 配置 IIS 的 InstallScript 脚本
- [3月25日的脚本] 重设文件关联 (VBScript)
- 用程序实现文件的关联
- NextInstaller 和 installshield注册文件的比较
- InstallShield中SUPPORTDIR的初始文件列表
- InstallShield打包的setup文件命令行参数
- 如何实现文件关联
- vc++实现文件关联
- 如何实现文件关联
- C#实现文件关联
- VC 实现文件关联
- c++ 文件关联实现
- Make Apple PUSH PEM
- 调整心情方法【转】
- stm中32DMA参数设置
- 羽毛球
- 重新签名已有的ipa包
- Installshield 实现文件关联的脚本
- Android开发者必知的开发资源
- (哈希)POJ2785
- poj - 2411 - Mondriaan's Dream(轮廓线dp)
- VC中检测USB状态的变化
- JVM垃圾收集器与内存分配策略
- Yii框架下使用memcached来存取数据时,key的生成方式
- PCB中TOP PASTE和TOP SOLDER的区别
- USB HID类命令