真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.net鼠標(biāo)穿透 窗口鼠標(biāo)穿透

VB實(shí)現(xiàn)窗體鼠標(biāo)穿透

Const

“專業(yè)、務(wù)實(shí)、高效、創(chuàng)新、把客戶的事當(dāng)成自己的事”是我們每一個(gè)人一直以來(lái)堅(jiān)持追求的企業(yè)文化。 創(chuàng)新互聯(lián)公司是您可以信賴的網(wǎng)站建設(shè)服務(wù)商、專業(yè)的互聯(lián)網(wǎng)服務(wù)提供商! 專注于成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)、軟件開(kāi)發(fā)、設(shè)計(jì)服務(wù)業(yè)務(wù)。我們始終堅(jiān)持以客戶需求為導(dǎo)向,結(jié)合用戶體驗(yàn)與視覺(jué)傳達(dá),提供有針對(duì)性的項(xiàng)目解決方案,提供專業(yè)性的建議,創(chuàng)新互聯(lián)建站將不斷地超越自我,追逐市場(chǎng),引領(lǐng)市場(chǎng)!

GWL_EXSTYLE

=

(-20)

Const

WS_EX_LAYERED

=

H80000

Const

WS_EX_

TRANSPARENT

As

Long

=

H20

Private

Declare

Function

GetWindowLong

Lib

"user32"

Alias

"GetWindowLongA"

(ByVal

hwnd

As

Long,

ByVal

nIndex

As

Long)

As

Long

Private

Declare

Function

SetWindowLong

Lib

"user32"

Alias

"SetWindowLongA"

(ByVal

hwnd

As

Long,

ByVal

nIndex

As

Long,

ByVal

dwNewLong

As

Long)

As

Long

Private

Sub

Command1_Click()

SetWindowLong

Me.hwnd,

GWL_EXSTYLE,

GetWindowLong(Me.hwnd,

GWL_EXSTYLE)

Or

WS_EX_LAYERED

Or

WS_EX_TRANSPARENT

End

Sub

'取消鼠標(biāo)穿透(一般窗體)

SetWindowLong

Me.hwnd,

GWL_EXSTYLE,

'取消鼠標(biāo)穿透(UpdateLayeredWindow畫(huà)窗體)

SetWindowLong

Me.hwnd,

GWL_EXSTYLE,

WS_EX_LAYERED

VB.NET模擬鼠標(biāo)問(wèn)題

Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)

Dim postion1 As New Point

mouse_event(H1 Or H8000, postion1.X * 65535 / 1366, postion1.Y * 65535 / 768, 0, 0)

'按絕對(duì)位置移動(dòng)鼠標(biāo)

'在鼠標(biāo)坐標(biāo)系統(tǒng)中,屏幕在水平和垂直方向上均勻分割成65535×65535個(gè)單元,

'當(dāng)前所用顯示屏分辨率為1366*768

'所以要進(jìn)行如上轉(zhuǎn)換

mouse_event(H2, 0, 0, 0, 0) '鼠標(biāo)左鍵按下

mouse_event(H4, 0, 0, 0, 0) '鼠標(biāo)左鍵彈起

msdn上有 mouse_event 的詳解,大致使用如上

如何在VB.net中用程序控制鼠標(biāo)移動(dòng)和點(diǎn)擊

調(diào)用api

在Visual Baisc.net中的聲明:

Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

Public Const MOUSEEVENTF_LEFTDOWN = H2 '模擬鼠標(biāo)左鍵按下

Public Const MOUSEEVENTF_LEFTUP = H4 ’模擬鼠標(biāo)左鍵釋放

Public Const MOUSEEVENTF_MIDDLEDOWN = H20 '模擬鼠標(biāo)中間鍵按下

Public Const MOUSEEVENTF_MIDDLEUP = H40 '模擬鼠標(biāo)中間鍵釋放

Public Const MOUSEEVENTF_RIGHTDOWN = H8 '模擬鼠標(biāo)右鍵按下

Public Const MOUSEEVENTF_RIGHTUP = H10 '模擬鼠標(biāo)右鍵釋放

Public Const MOUSEEVENTF_MOVE = H1 '模擬鼠標(biāo)指針移動(dòng)

例:

mouse_event MOUSEEVENTF_LEFTDOWN,10,10,0,0

'在(10,10)模擬鼠標(biāo)左鍵按下

VB.NET怎么可以限制窗體不能被鼠標(biāo)隨便拖動(dòng)位置

很簡(jiǎn)單,通過(guò)WindowsAPI,刪除窗體菜單項(xiàng)就行了

首先在窗體類中聲明API:

Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As IntPtr, ByVal bRevert As Boolean) As IntPtr

Declare Function RemoveMenu Lib "user32" (ByVal lngHmenu As IntPtr, ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer

其次聲明API參數(shù)常量:

Const MF_BYPOSITION As Integer = H400

然后在窗體類中寫(xiě)入過(guò)程:

Private Sub UserForm_Initialize_stopmove() '禁止窗體移動(dòng)

? Dim lngHwnd As IntPtr

? Dim lngHmenu As IntPtr

? lngHwnd = Me.Handle

? If lngHwnd 0 Then

? ? ? lngHmenu = GetSystemMenu(lngHwnd, False)

? ? ? RemoveMenu(lngHmenu, 0, MF_BYPOSITION) '這里的0代表菜單中從上往下數(shù)第一個(gè)菜單項(xiàng)

? End If

End Sub

Private Sub UserForm_Initialize_onmove() '恢復(fù)窗體移動(dòng)

? Dim lngHwnd As IntPtr

? Dim lngHmenu As IntPtr

? lngHwnd = Me.Handle

? If lngHwnd 0 Then

? ? ? lngHmenu = GetSystemMenu(lngHwnd, True)

RemoveMenu(lngHmenu, 0, MF_BYPOSITION) '這里的0與禁止代碼中的數(shù)值同步,原因時(shí)雖然表面上刪除了菜單項(xiàng),實(shí)則為隱藏了菜單項(xiàng),各個(gè)菜單的索引值并沒(méi)有變,所以0依然代表初始菜單的第一個(gè)菜單項(xiàng),即被刪除的那個(gè)菜單項(xiàng)

? End If

End Sub

然后如果你的窗口菜單是動(dòng)態(tài)變化的,建議聲明常數(shù):

Const MF_BYPOSITION As Integer = H0

然后使用相關(guān)的Windows功能的常數(shù)進(jìn)行刪除菜單。常數(shù)需要自行查看winuser.h頭文件

如果找不到該頭文件,可以看這里:網(wǎng)頁(yè)鏈接

其余信息詳見(jiàn)MSDN:網(wǎng)頁(yè)鏈接

最后說(shuō)一下,不建議前面網(wǎng)友說(shuō)的重寫(xiě)WndProc的方法,因?yàn)檫@樣攔截標(biāo)題欄點(diǎn)擊消息會(huì)導(dǎo)致窗體本身的菜單也無(wú)法顯示出來(lái),有損窗體功能,并且像雙擊左上角圖標(biāo)關(guān)閉窗體這樣的功能也會(huì)跟著攔截消息的操作一起被吞掉。

vb2008 ( vb .net ) 下如何實(shí)現(xiàn) 鼠標(biāo)穿透 ??

Const GWL_EXSTYLE = (-20)

Const WS_EX_LAYERED = H80000

Const WS_EX_TRANSPARENT As Integer= H20

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer) As Integer

Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer

Private Sub Command1_Click()

SetWindowLong Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED Or WS_EX_TRANSPARENT

End Sub

'取消鼠標(biāo)穿透(一般窗體) SetWindowLong Me.hwnd, GWL_EXSTYLE, 0

'取消鼠標(biāo)穿透(UpdateLayeredWindow畫(huà)窗體) SetWindowLong Me.hwnd, GWL_EXSTYLE, WS_EX_LAYERED


新聞名稱:vb.net鼠標(biāo)穿透 窗口鼠標(biāo)穿透
文章鏈接:http://weahome.cn/article/hjejpc.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部