日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

dsoframer控件注册,解注册和检查注册情况

發(fā)布時間:2025/7/25 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 dsoframer控件注册,解注册和检查注册情况 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
public class DsoframerHelper{private static string dsoframerPath = System.Windows.Forms.Application.StartupPath + @"/Plugins/dsoframer.ocx";private static string sys32Path = @"c:\windows\System32\dsoframer.ocx";//32位系統(tǒng)存放dsoframer.ocx的目錄private static string sys64Path = @"c:\windows\SysWOW64\dsoframer.ocx";//64位系統(tǒng)存放dsoframer.ocx的目錄/// <summary>/// 判斷ocx控件是否注冊的/// </summary>/// <param name="clsid"></param>/// <returns></returns>private static bool IsRegistered(string clsid){String key = String.Format(@"CLSID\{{{0}}}", clsid);Microsoft.Win32.RegistryKey Regkey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(key);if (Regkey != null)return true;elsereturn false;}/// <summary>/// 執(zhí)行cmd.exe/// </summary>/// <param name="cmdExe"></param>/// <param name="cmdPara"></param>private static void Cmd(string cmdExe, string cmdPara){using (System.Diagnostics.Process myPro = new System.Diagnostics.Process()){myPro.StartInfo.FileName = "cmd.exe";myPro.StartInfo.UseShellExecute = false; //是否使用操作系統(tǒng)shell啟動myPro.StartInfo.RedirectStandardInput = true;//接受來自調(diào)用程序的輸入信息 myPro.StartInfo.RedirectStandardOutput = true;//由調(diào)用程序獲取輸出信息myPro.StartInfo.RedirectStandardError = true;//重定向標準錯誤輸出myPro.StartInfo.CreateNoWindow = true;//不顯示程序窗口myPro.Start();string strCmd = $@"{cmdExe} {cmdPara} &exit"; //這里使用 & 是批處理命令的符號,表示前面一個命令不管是否執(zhí)行成功都執(zhí)行后面(exit)命令myPro.StandardInput.WriteLine(strCmd);myPro.StandardInput.AutoFlush = true;myPro.WaitForExit();//等待程序執(zhí)行完退出進程}}/// <summary>/// 判斷dsoframer是否注冊/// </summary>/// <returns></returns>public static bool IsRegisteredDsoframer(){return IsRegistered("00460182-9E5E-11d5-B7C8-B8269041DD57");}/// <summary>/// 注冊dsoframer/// </summary>public static void RegisteredDsoframer(){if (!File.Exists(dsoframerPath))return;//將dsoframer.ocx拷貝到系統(tǒng)目錄string sysPath = "";if (Environment.Is64BitOperatingSystem)sysPath = sys64Path;elsesysPath = sys32Path;if (!File.Exists(sysPath))File.Copy(dsoframerPath, sysPath);Cmd("regsvr32.exe", sysPath);}/// <summary>/// 解注冊dsoframer/// </summary>public static void UnRegisteredDsoframer(){Cmd("regsvr32.exe", $@" -u {dsoframerPath}");}}

  

(1)準備工作: 

在解決方案下創(chuàng)建Plugins目錄,然后將dsoframer.ocx復制到Plugins目錄下

(2)使用:

if (!DsoframerHelper.IsRegisteredDsoframer())DsoframerHelper.RegisteredDsoframer();

  

?

檢查ocx控件是否注冊需要用到clsid,一下是查找方法

查看ocx控件CLSID的方法(轉(zhuǎn)載)

dsoframer.ocx(32位)下載地址:https://pan.baidu.com/s/16Jd60vgU09KYxzOlZsti-A? ? 提取碼:7xgh? ?內(nèi)涵函數(shù)使用方法

轉(zhuǎn)載于:https://www.cnblogs.com/yaosj/p/10877384.html

總結(jié)

以上是生活随笔為你收集整理的dsoframer控件注册,解注册和检查注册情况的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。