主题:component'comdlg32.ocx' 问题
zhoupang
[专家分:0] 发布于 2010-07-25 14:35:00
运行可执行文件exe之后出现如下提示信息
component 'comdlg32.ocx' or one of its dependencies not correctly registered: a file is missing or invalid.
请问怎么解决?先谢了!
回复列表 (共4个回复)
沙发
天天学习 [专家分:4570] 发布于 2010-07-26 11:16:00
把comdlg32.ocx也放到客户的电脑上,并注册。
regsvr32 comdlg32.ocx
或者不要使用dialog控件,改为调用api。
[code=c]
Option Explicit
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Private Const OFN_PATHMUSTEXIST = &H800 '路径必须存在
Private Const OFN_FILEMUSTEXIST = &H1000 '文件必须存在
'' OPENFILENAME 结构的元素顺序必须按vb6自带的api浏览器里的格式声明。按foxApi V1.5里的声明时出错
Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Public Function ShowOpen(ByVal hwndOwner As Long, _
Optional ByVal strTitle As String = "打开...", _
Optional ByVal lpstrFilter As String = "All Files(*.*)" & vbNullChar & "*.*" & vbNullChar, _
Optional ByVal initDir As String = "c:\", _
Optional ByVal defExt As String = "*.JTF") As String
On Error Resume Next
Dim OFName As OPENFILENAME
OFName.lStructSize = Len(OFName)
OFName.hwndOwner = hwndOwner
OFName.lpstrFilter = lpstrFilter
OFName.lpstrFile = Space$(254)
OFName.nMaxFile = 255
OFName.lpstrFileTitle = Space$(254)
OFName.nMaxFileTitle = 255
OFName.lpstrInitialDir = initDir
OFName.lpstrTitle = strTitle
OFName.lpstrDefExt = defExt
OFName.flags = OFN_FILEMUSTEXIST Or OFN_PATHMUSTEXIST
'Debug.Print OFName.nFileExtension
If GetOpenFileName(OFName) Then
ShowOpen = Trim$(OFName.lpstrFile)
Else
ShowOpen = ""
End If
End Function
[/code]
板凳
zhoupang [专家分:0] 发布于 2010-07-27 12:51:00
我按照你说的把comdlg32.ocx也放到客户的电脑上,并注册。
regsvr32 comdlg32.ocx。但是显示什么二进制问题,我的系统是windows vista。
3 楼
merry05 [专家分:8920] 发布于 2010-07-27 14:37:00
请把“什么”两个字详细扩展成具体问题
4 楼
孙瑞 [专家分:590] 发布于 2010-10-08 19:13:00
“天天学习”大大说的是对的!
我来回复