标题:API函数获取记事本信息的问题
只看楼主
lhx1986
Rank: 2
等 级:论坛游民
帖 子:26
专家分:44
注 册:2013-8-15
结帖率:77.78%
已结贴  问题点数:10 回复次数:2 
API函数获取记事本信息的问题
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Private Sub Command1_Click()
Dim a As Long
Dim b As Long
Dim d As Long
Dim c As String

a = FindWindow(vbNullString, "无标题 - 记事本")
d = FindWindowEx(a, 0, "Edit", vbNullString)
c = Space(255)
GetWindowText d, c, 255
Text1.Text = c
End Sub
为什么text1获取不了记事本的内容,记事本是打开着的。哪位老师能指教?
搜索更多相关主题的帖子: 记事本 信息 
2013-09-08 19:47
bczgvip
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:66
帖 子:1310
专家分:5312
注 册:2009-2-26
得分:7 

你打开的是现有的文件吧.【xxx.txt - 记事本】
直接用类名找不好过么
2013-09-09 01:06
lhx1986
Rank: 2
等 级:论坛游民
帖 子:26
专家分:44
注 册:2013-8-15
得分:0 
能找到记事本但就是获取不了其中的内容
2013-09-09 10:03



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-420305-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.133683 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved