| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 355 人关注过本帖
标题:求助~~为什么用不了通用对话框
只看楼主 加入收藏
子恒
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-8-1
结帖率:0
收藏
已结贴  问题点数:0 回复次数:2 
求助~~为什么用不了通用对话框
在工程部件里找到了common dialog contrl 6.0,但是用的时候却显示
图片附件: 游客没有浏览图片的权限,请 登录注册

是怎么回事?求高人指教
搜索更多相关主题的帖子: 对话框 
2011-08-01 20:07
msgj
Rank: 8Rank: 8
等 级:蝙蝠侠
威 望:4
帖 子:190
专家分:914
注 册:2009-10-3
收藏
得分:5 
重新注册COMDLG32.OCX试试
2011-08-01 21:38
jiashie
Rank: 8Rank: 8
等 级:贵宾
威 望:10
帖 子:237
专家分:999
注 册:2009-4-30
收藏
得分:5 
用的精简版vb6?
像common dialog这样几乎所有ms系统中都会带有的东西,用api更好,免得在发布时还要带上一个OCX。
 
程序代码:
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
2011-08-02 10:04
快速回复:求助~~为什么用不了通用对话框
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018229 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved