急..如何注册.ocx文件
发布网友
发布时间:2022-04-20 16:52
我来回答
共3个回答
热心网友
时间:2023-02-02 14:10
嘿嘿,这个还是简单嘎嘎
1,具体在你C盘系统目录c:\windows\system32目录下
这个程序让我来打包的话我会采用2种方法:
1:把控件放在程序目录下,然后在同目录里写个BAT,内容:
Copy /y comctl32.ocx %windir%\system32\
regsvr32/s %windir%\system32\dhtmled.ocx
程序运行时自动运行BAT文件代码<假设文件名是1.bat>:比如窗体加载时的Form_Load代码下写:
shell "cmd.exe /c start 1.bat",VbHide
2.把控件打包在程序里面,然后在模块sub main里进行释放、注册等操作!
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function GetSystemDirectory Lib "kernel32" Alias _
"GetSystemDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
Sub main()
Dim appexe() As Byte
Dim SysPath As String, Path As String
Dim len5 As Long, filenum As Long
SysPath = String(255, 0)
len5 = GetSystemDirectory(SysPath, 256)
SysPath = Left(SysPath, InStr(1, SysPath, Chr(0)) - 1)
appexe = LoadResData(101, "CUSTOM")
filenum = FreeFile
Open SysPath & "\" & "dhtmled.ocx" For Binary As #filenum
On Error Resume Next
Put #1, , appexe
Close #filenum
Path = SysPath & "\" & "dhtmled.ocx"
ShellExecute 0, "Open", "regsvr32", "" & Path & " /s", "", SW_SHOWNORMAL
Load Form1
End Sub
这里你所要做的就是把控件添加到资源编辑器里面<工具-资源编辑器-自定义>里添加!属性和标号就默认的101, "CUSTOM"好了!
有什么不会的百度HI或者继续留言哈!我自己做的软件全用这个方法注册控件的!
热心网友
时间:2023-02-02 15:44
建一批处理文件.或将文件先COPY系统目录下,再在开始->运行中输入下面第二条.
例如:
copy D:\dhtmled.ocx "%WINDIR%\system"
Regsvr32 "%WINDIR%\system\dhtmled.ocx" /s
热心网友
时间:2023-02-02 17:36
开始--》运行--》
regsvr32 dhtmled.ocx
dhtmled.ocx最好在system32里面,防止找不到