「java定义hwnd」Java定义常量
本篇文章给大家谈谈java定义hwnd,以及Java定义常量对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
- 1、java调用GetWindowRect怎么传参数
- 2、java 如何获取活动窗口的大小
- 3、在VC6.0中,HWND、hwnd、hWnd三者之间有什么区别?若有,那么区别是什么?能详细地讲解一下吗?
- 4、thandle,hdc,hwnd有什么区别?
java调用GetWindowRect怎么传参数
GetWindowRect方法的完整描述
boolean com.sun.jna.platform.win32.User32.GetWindowRect(HWND arg0, RECT arg1)
Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.
传入的参数是HWND 窗口的句柄 ,根据你自己的需求传入窗口句柄
User32 INSTANCE =(User32) Native.loadLibrary(User32.class, W32APIOptions.UNICODE_OPTIONS);
HWND hwnd = User32.INSTANCE.FindWindow("yourWindowClassName", "yourWindowName");//参数是: 窗口的类,和窗口的标题
//这两个参数,至少一个不为null
// RECT 参数,可以提前构造一个 ,代码如下
WinDef.RECT rect = new WinDef.RECT();
最后调用GetWindowRect方法
User32.INSTANCE.GetWindowRect(hwnd, rect);//最后获取到的数据都存在了rect里面, 可以取出来用
int myWidth = rect.right - rect.left; // 右顶点-左顶点= 宽
int myHight = rect.bottom - rect.top;// 下顶点-上顶点 = 高
java 如何获取活动窗口的大小
'VB获得活动窗口标题、位置、大小
'运行后,在form上print当前活动窗口信息
Private Declare Function GetActiveWindow Lib "user32" () 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 GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub Form_Load()
Me.AutoRedraw = True
Timer1.Interval = 2000
Timer1.Enabled = True
End Sub
Sub Timer1_Timer()
Dim p As RECT
Dim h As Long
Dim str1 As String
h = GetActiveWindow '获得活动窗口句柄
str1 = String(255, 0)
GetWindowText h, str1, 255 '获得标题
GetWindowRect h, p '获得窗口位置、大小
Print "窗口标题:" Left(str1, InStr(str1, Chr(0)) - 1) " 窗口位置:Left=" p.Left " Top=" p.Top " 大小是:" p.Right - p.Left "X" p.Bottom - p.Top
End Sub
在VC6.0中,HWND、hwnd、hWnd三者之间有什么区别?若有,那么区别是什么?能详细地讲解一下吗?
HWND 是窗口句柄的类(handle of window)
hwnd、hWnd都是定义一个HWND的类,只不过微软用的都是匈牙利命名法,所以微软文档中都是用hWnd的,hwnd估计是一般应用MFC的程序员这样用。
thandle,hdc,hwnd有什么区别?
Thandle
=
LongWord;本质上是一样的。你看看VCL源代码就知道了。都是无符号整数!只不过HDC用于表示Device
Context
handle,Hwnd表示Windows
Handle,Thandle实际上就是hwnd。
HWND
=
type
LongWord;
HDC
=
type
LongWord;
java定义hwnd的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于Java定义常量、java定义hwnd的信息别忘了在本站进行查找喔。
发布于:2022-12-08,除非注明,否则均为
原创文章,转载请注明出处。