如何發布應用程式

來源:互聯網
上載者:User
需求:

發布一個使用了MSCOMM32.OCX的mfc串口控製程序。OCX需要註冊。

可以手動註冊OCX,在命令列下輸入以下語句,成功以後會有提示

 RegSver32 “C:/Documents and Settings/Owner/案頭/dm2005_dao/Sys/MSCOMM32.ocx"

登出OCX,輸入以下語句,成功後有提示

RegSvr32 /u MSCOMM32.ocx

  要發布應用程式,需要自動註冊和登出OCX控制項

解決方案

可以選擇InstallShield,但是這個程式實在是大。。。後來選擇了Inno Setupd,根據該軟體提供了模板,設定主exe,添加exe依賴的dll等檔案。嘗試建立幾次就輕鬆搞定。

在建立的iss源檔案中:

[Files]<br />Source: "E:/COTDR_Release/gl_mase_v10/COTDR.exe"; DestDir: "{app}"; Flags: ignoreversion<br />Source: "E:/COTDR_Release/gl_mase_v10/MSCOMM32.OCX"; DestDir: "{sys}"; CopyMode: alwaysskipifsameorolder; Flags: restartreplace regserver

 上面程式碼片段中,第二句將MSCOMM32.OCX放到系統檔案夾(system32)下面,後面Flags標誌是註冊。

[UninistallRun]<br />Filename: "regsvr32"; Parameters:"/u MSCOMM32.ocx"<br />[UninstallDelete]<br />Type: files; Name:"{sys}//MSCOMM32.ocx"

 上面程式碼片段中,卸載的時候,登出MSCOMM32.OCX,刪除的時候移除系統檔案夾中的OCX控制項。

一個完整的安裝程式的源檔案(*.iss)  - add by 2011-10-10

; 指令碼由 Inno Setup 指令碼嚮導 產生!; 有關建立 Inno Setup 指令檔的詳細資料請查閱協助文檔!#define MyAppName "播放器用戶端外掛程式"#define MyAppVersion "1.0.0.3"#define MyAppPublisher "杭州盈貨通科技有限公司"#define MyAppURL "http://yingtongkj.cn.alibaba.com/"#define MyAppExeName "MyProg.exe"[Setup]; 注: AppId的值為單獨標識該應用程式。; 不要為其他安裝程式使用相同的AppId值。; (產生新的GUID,點擊 工具|在IDE中產生GUID。)AppId={{35C8E93D-5FDA-45CF-9403-3C987A34C620}AppName={#MyAppName}AppVersion={#MyAppVersion};AppVerName={#MyAppName} {#MyAppVersion}AppPublisher={#MyAppPublisher}AppPublisherURL={#MyAppURL}AppSupportURL={#MyAppURL}AppUpdatesURL={#MyAppURL}CreateAppDir=noOutputDir=C:\Users\RenYafei\DesktopOutputBaseFilename=setupCompression=lzmaSolidCompression=yes[Languages]Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"[Files]Source: "I:\9-2\Player.ocx"; DestDir: "{sys}"; CopyMode: alwaysskipifsameorolder; Flags: restartreplace regserverSource: "I:\9-2\Ds40xxSDK.dll"; DestDir: "{sys}"; Flags: ignoreversionSource: "I:\9-2\HCNetSDK.dll"; DestDir: "{sys}"; Flags: ignoreversionSource: "I:\9-2\hikclient.dll"; DestDir: "{sys}"; Flags: ignoreversionSource: "I:\9-2\hpr.dll"; DestDir: "{sys}"; Flags: ignoreversionSource: "I:\9-2\mfc90.dll"; DestDir: "{sys}"; Flags: ignoreversionSource: "I:\9-2\msvcp90.dll"; DestDir: "{sys}"; Flags: ignoreversionSource: "I:\9-2\msvcr90.dll"; DestDir: "{sys}"; Flags: ignoreversionSource: "I:\9-2\PlayCtrl.dll"; DestDir: "{sys}"; Flags: ignoreversion[UninistallRun]Filename: "regsvr32"; Parameters:"/u Player.ocx"[UninstallDelete]Type: files; Name:"{sys}//Player.ocx"Type: files; Name:"{sys}//Ds40xxSDK.dll"Type: files; Name:"{sys}//HCNetSDK.dll"Type: files; Name:"{sys}//hikclient.dll"Type: files; Name:"{sys}//hpr.dll"Type: files; Name:"{sys}//mfc90.dll"Type: files; Name:"{sys}//msvcp90.dll"Type: files; Name:"{sys}//msvcr90.dll"Type: files; Name:"{sys}//PlayCtrl.dll"; 注意: 不要在任何共用系統檔案上使用“Flags: ignoreversion”

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.