明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 708|回复: 2

请教 64位 OPENFILENAME

[复制链接]
发表于 2015-7-25 18:57:30 | 显示全部楼层 |阅读模式
  1. <p>Public Declare PtrSafe Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long</p><p>
  2. </p><p>Type OPENFILENAME</p><p>     lStructSize As Long</p><p>     hwndOwner As Long</p><p>     hInstance As Long</p><p>     lpstrFilter As String</p><p>     lpstrCustomFilter As String</p><p>     nMaxCustFilter As Long</p><p>     nFilterIndex As Long</p><p>     lpstrFile As String</p><p>     nMaxFile As Long</p><p>     lpstrFileTitle As String</p><p>     nMaxFileTitle As Long</p><p>     lpstrInitialDir As String</p><p>     lpstrTitle As String</p><p>     flags As Long</p><p>     nFileOffset As Integer</p><p>     nFileExtension As Integer</p><p>     lpstrDefExt As String</p><p>     lCustData As Long</p><p>     lpfnHook As Long</p><p>     lpTemplateName As String</p><p>End Type</p>
  3. <div>Function GetTextFile() As String</div><div>    Dim ofn As OPENFILENAME</div><div>    Dim rtn As String</div><div>    ofn.lStructSize = Len(ofn)</div><div>    ofn.hwndOwner = CLng(Application.hwnd)</div><div>    'ofn.hInstance = Application.hwnd</div><div>    ofn.lpstrFilter = "text Files (*.txt)" & Chr(0) & "*.txt" & Chr(0)</div><div>    ofn.lpstrFile = Space(254)</div><div>    ofn.nMaxFile = 255</div><div>    ofn.lpstrFileTitle = Space(254)</div><div>    ofn.nMaxFileTitle = 255</div><div>    ofn.lpstrInitialDir = "C:/"</div><div>    ofn.lpstrTitle = "打开文件"</div><div>    ofn.flags = 6148</div><div>    rtn = GetOpenFileName(ofn)</div><div>    </div><div>    If rtn >= 1 Then</div><div>        GetTextFile = ofn.lpstrFile</div><div>    Else</div><div>        </div><div>    End If</div><div>    </div><div>End Function</div>
想用以上代码在64位的win7上打开文本框,不知道为什么怎么也用不了,求大神指导!万分感谢!
发表于 2015-7-29 22:21:51 | 显示全部楼层
楼主努力!
发表于 2015-8-9 23:31:35 | 显示全部楼层
将其中的“Application.hwnd”全改为“ThisDrawing.HWnd32”试试!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 09:25 , Processed in 0.149724 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表