*、vb6用api实现comdialog对话框

*、vb6用api实现comdialog对话框,第1张

概述'从哪里找来的资料已经忘了,老外发布的 Option Explicit Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long Private Type OPENFILENAME     lStructSi

'从哪里找来的资料已经忘了,老外发布的

Option Explicit
Private Declare Function Getopenfilename lib "comdlg32.dll" Alias "GetopenfilenameA" (pOpenfilename As OPENfilename) As Long

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

Private Sub Command1_Click()

Dim Openfile As OPENfilename Dim lReturn As Long Dim sFilter As String Openfile.lStructSize = Len(Openfile) Openfile.hwndOwner = Form1.hWnd Openfile.hInstance = App.hInstance sFilter = "Batch files (*.bat)" & Chr(0) & "*.BAT" & Chr(0) Openfile.lpstrFilter = sFilter Openfile.nFilterIndex = 1 Openfile.lpstrfile = String(257,0) Openfile.nMaxfile = Len(Openfile.lpstrfile) - 1 Openfile.lpstrfileTitle = Openfile.lpstrfile Openfile.nMaxfileTitle = Openfile.nMaxfile Openfile.lpstrInitialDir = "C:\" Openfile.lpstrTitle = "Use the Comdlg API not the OCX" Openfile.flags = 0 lReturn = Getopenfilename(Openfile) If lReturn = 0 Then MsgBox "The User pressed the Cancel button" Else MsgBox "The user Chose " & Trim(Openfile.lpstrfile) End If End Sub

总结

以上是内存溢出为你收集整理的*、vb6用api实现comdialog对话框全部内容,希望文章能够帮你解决*、vb6用api实现comdialog对话框所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1281531.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存