有类似Commondialog功能的第三方控件吗?
vb吧
全部回复
仅看楼主
level 9
klimaa 楼主
我想做个软件,但不想用commondialog,因为不想做安装包,让人用起来方便点。有合适的第三方控件吗?或者有别的办法?
2020年07月01日 07点07分 1
level 9
klimaa 楼主
哦,是要打开文件,浏览文件的
2020年07月01日 07点07分 2
level 10
不是自带dir和file控件吗
2020年07月01日 07点07分 3
level 8
网上有现成的,自己封个类,就可以当控件用
2020年07月01日 07点07分 4
level 9
klimaa 楼主
@mijing2000 不好找啊,不过终于找到了。我还不会封类呢。
2020年07月01日 09点07分 5
这种标准模块就行,复制粘贴进去基本就行了
2020年07月01日 11点07分
level 13
可以调用API函数实现,GetOpenFileName(文件打开对话框)、GetSaveFileName(文件保存对话框)、ChooseFont(字体...)、 ChooseColor(颜色...)
2020年07月01日 09点07分 6
一直不知道有这样的API,谢谢~~
2020年07月03日 23点07分
level 8
网上复制了一个,我整理了下,基本有commondialog的功能,要的留邮箱
2020年07月01日 12点07分 7
我的邮箱:[email protected]
2020年07月03日 23点07分
谢谢~~~~
2020年07月03日 23点07分
@klimaa 已发
2020年07月04日 01点07分
@mijing2000 收到了,非常好用,谢谢~
2020年07月06日 11点07分
吧务
level 13
这里没有放置【通用对话框】图标
2020年07月01日 16点07分 8
吧务
level 13
' ===========================================
' Module1.BAS           【开始】
' -------------------------------------------
Option Explicit
Declare Function GetOpenFileName _
Lib "comdlg32.dll" Alias "GetOpenFileNameA" _
(pOpenfilename As OPENFILENAME) As Long
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
' -------------------------------------------
' Module1.BAS           【结束】
' ===========================================
' :
' ===========================================
' 通用对话框⑴           【开始】
' -------------------------------------------
Option Explicit
Private Sub Form_Load()
Me.Width = 8000
Me.Height = 4500
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Form_Resize()
On Error Resume Next
Dim n1&, n2&
n1 = Me.Width
n2 = Me.Height
n1 = IIf(n1 < 8000, 8000, n1)
n2 = IIf(n2 < 4500, 4500, n2)
Me.Width = n1
Me.Height = n2
Text1.Width = n1 - 2100
Command1.Left = n1 - 1640
Text2.Width = n1 - 660
Text2.Height = n2 - 1245
End Sub
Private Sub Command1_MouseMove( _
Button As Integer, Shift As Integer, _
X As Single, Y As Single)
Command1.SetFocus
End Sub
Private Sub Command1_Click()
Dim ofn As OPENFILENAME
Dim rtn As String
Dim cWJ As String
Dim cTS As String
ofn.lStructSize = Len(ofn)
ofn.hwndOwner = Me.hWnd
ofn.hInstance = App.hInstance
ofn.lpstrFilter = "所有文件(*.*)"
ofn.lpstrFile = Space(254)
ofn.nMaxFile = 255
ofn.lpstrFileTitle = Space(254)
ofn.nMaxFileTitle = 255
ofn.lpstrInitialDir = App.Path
ofn.lpstrTitle = "打开文件"
ofn.flags = 6148
rtn = GetOpenFileName(ofn)
If rtn >= 1 Then
Text1.Text = ofn.lpstrFile
cWJ = Trim(Text1.Text)
Text2.Text = ""
If Dir(cWJ, vbHidden) <> "" Then
Open cWJ For Input As #1
Do While Not (EOF(1))
Line Input #1, cTS
If EOF(1) Then
Text2.Text = Text2.Text & cTS
Else
Text2.Text = Text2.Text & cTS & vbCrLf
End If
Loop
Close #1
End If
Else
Text1.Text = ""
End If
End Sub
' -------------------------------------------
' 通用对话框⑴           【结束】
' ===========================================
2020年07月01日 16点07分 9
太感谢了~~
2020年07月03日 23点07分
请教一下,那个flags做什么用的
2020年07月03日 23点07分
@klimaa 去MSDN搜一下就有了
2020年07月04日 01点07分
@心中独火点亮 我基本上都是跟着MSDN学的,这个不得要领。
2020年07月04日 03点07分
level 13
OFN_开头的都是,API Viewer有些没有,得自己找
2020年07月04日 05点07分 10
了解,谢谢大佬
2020年07月04日 09点07分
level 13
2020年07月04日 05点07分 12
看明白了
2020年07月04日 09点07分
1