首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

GetWindowText报错

2013-11-25 
GetWindowText报错求助我的系统为win7 64位+vs2010代码如下:Private Declare Auto Function FindWindow Li

GetWindowText报错求助
我的系统为win7 64位+vs2010

代码如下:


Private Declare Auto Function FindWindow Lib "user32" (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 Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim hWnd As Long
        hWnd = FindWindow("FxMain", vbNullString)
        Dim a As String
        a = Space(255)
        GetWindowText(hWnd, a, 255) '报错
        MessageBox.Show(a)
    End Sub


请教getwindowtext的正确用法 GetWindowText
[解决办法]
这是VB6的定义,Long全部改为Integer

热点排行