请教 64位 OPENFILENAME
Public Declare PtrSafe 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
Function GetTextFile() As String Dim ofn As OPENFILENAME Dim rtn As String ofn.lStructSize = Len(ofn) ofn.hwndOwner = CLng(Application.hwnd) 'ofn.hInstance = Application.hwnd ofn.lpstrFilter = "text Files (*.txt)" & Chr(0) & "*.txt" & Chr(0) ofn.lpstrFile = Space(254) ofn.nMaxFile = 255 ofn.lpstrFileTitle = Space(254) ofn.nMaxFileTitle = 255 ofn.lpstrInitialDir = "C:/" ofn.lpstrTitle = "打开文件" ofn.flags = 6148 rtn = GetOpenFileName(ofn) If rtn >= 1 Then GetTextFile = ofn.lpstrFile Else End If End Function想用以上代码在64位的win7上打开文本框,不知道为什么怎么也用不了,求大神指导!万分感谢!
楼主努力! 将其中的“Application.hwnd”全改为“ThisDrawing.HWnd32”试试!
页:
[1]