| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1175 人关注过本帖
标题:各位前輩好!!該如何在VS2008中調用GetWindowRect
取消只看楼主 加入收藏
uirty
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-12-4
结帖率:100%
收藏
已结贴  问题点数:0 回复次数:1 
各位前輩好!!該如何在VS2008中調用GetWindowRect
2008中並無報告出錯 ,但是程式按鍵執行就當.....請各位前輩指導T_T.
程序代码:
Public Class Form1
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
    Private Declare Function SetCursorPos Lib "user32" Alias "SetCursorPos" (ByVal x As Long, ByVal y As Long) As Integer
    Private Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, ByVal lpRect As RECT) As Integer
    Private Structure RECT
        Public Left As Integer
        Public Top As Integer
        Public Right As Integer
        Public Bottom As Integer
    End Structure
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim windoh As Integer
        Dim windoxy As RECT
        Dim windoxd As Integer
        windoh = FindWindow(vbNullString, "新增文字文件 (6).txt - 記事本")

        If windoh = 0 Then
            MsgBox("無法獲取窗口")
            Threading.Thread.Sleep(100) ' 暫停1秒
            SetCursorPos(0, 0) ' 將滑鼠位置設定為0, 0
        End If

        windoxd = GetWindowRect(windoh, windoxy)

        TextBoxX.Text = windoxy.Top
        TextBoxY.Text = windoxy.Left
    End Sub
End Class

 
搜索更多相关主题的帖子: 如何 
2010-12-04 02:51
uirty
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-12-4
收藏
得分:0 
回复 2楼 不说也罢
感謝前輩的指導 我的腦亂了
2010-12-04 23:35
快速回复:各位前輩好!!該如何在VS2008中調用GetWindowRect
数据加载中...
 
   



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

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