vb将指定标题的窗口移动到指定位置
vb将指定标题的窗口移动到指定位置如:将标题为:“无标题-记事本”的窗口移动到屏幕位置为x=100,y=100的位置,代码怎么写?PrivateDeclareFuncti...
vb将指定标题的窗口移动到指定位置
如:将标题为:“无标题-记事本”的窗口移动到屏幕位置为x=100,y=100的位置,代码怎么写?
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Sub Command1_Click()
AppActivate "无标题 - 记事本"
End Sub
Private Sub Command2_Click()
'函数调用:(将,x,y换成你希望的坐标)
SetWindowPos 无标题 - 记事本, HWND_TOPMOST, 100, 100, 0, 0, 0
End Sub
代码如上,为何还不能将"无标题 - 记事本"窗口移动到指定位置? 展开
如:将标题为:“无标题-记事本”的窗口移动到屏幕位置为x=100,y=100的位置,代码怎么写?
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Sub Command1_Click()
AppActivate "无标题 - 记事本"
End Sub
Private Sub Command2_Click()
'函数调用:(将,x,y换成你希望的坐标)
SetWindowPos 无标题 - 记事本, HWND_TOPMOST, 100, 100, 0, 0, 0
End Sub
代码如上,为何还不能将"无标题 - 记事本"窗口移动到指定位置? 展开
2个回答
展开全部
用API函数SETWINDOWSPOS实现
函数声明:
Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
函数调用:(将,x,y换成你希望的坐标)
SetWindowspos me.hwnd,HWND_TOPMOST,x坐标,y坐标,0.0.0
函数声明:
Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
函数调用:(将,x,y换成你希望的坐标)
SetWindowspos me.hwnd,HWND_TOPMOST,x坐标,y坐标,0.0.0
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询