乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 74|回复: 2

请教 64位 OPENFILENAME

[复制链接]

2

主题

5

帖子

1

银币

初来乍到

Rank: 1

铜币
13
发表于 2015-7-25 18:57:00 | 显示全部楼层 |阅读模式
  1. Public Declare PtrSafe Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
  2. Type OPENFILENAME
  3.      lStructSize As Long
  4.      hwndOwner As Long
  5.      hInstance As Long
  6.      lpstrFilter As String
  7.      lpstrCustomFilter As String
  8.      nMaxCustFilter As Long
  9.      nFilterIndex As Long
  10.      lpstrFile As String
  11.      nMaxFile As Long
  12.      lpstrFileTitle As String
  13.      nMaxFileTitle As Long
  14.      lpstrInitialDir As String
  15.      lpstrTitle As String
  16.      flags As Long
  17.      nFileOffset As Integer
  18.      nFileExtension As Integer
  19.      lpstrDefExt As String
  20.      lCustData As Long
  21.      lpfnHook As Long
  22.      lpTemplateName As String
  23. End Type
  24. 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上打开文本框,不知道为什么怎么也用不了,求大神指导!万分感谢!
回复

使用道具 举报

23

主题

561

帖子

13

银币

中流砥柱

Rank: 25

铜币
653
发表于 2015-7-29 22:21:00 | 显示全部楼层
楼主努力!
回复

使用道具 举报

13

主题

99

帖子

5

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
151
发表于 2015-8-9 23:31:00 | 显示全部楼层
将其中的“Application.hwnd”全改为“ThisDrawing.HWnd32”试试!
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-4-20 05:13 , Processed in 1.509546 second(s), 59 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表