簡體   English   中英

API:參數dwExtraInfo被覆蓋

[英]API: Argument dwExtraInfo gets overwritten

我正在使用SendInput合成鼠標事件,如下所示。 一切都很好。 當我使用鼠標鈎子來檢測綜合值時(或僅使用ProcMon),就得到了我發送的內容。 具體來說,dwExtraInfo仍為1024。

現在,當我使用Windows 7時,dwExtraInfo將自動由Windows替換為數字:-11054848。 我不知道這是從哪里來的,我也沒有在MSDN上找到關於此的任何信息。

起初,我認為Windows只是將一個值“與”了我的值,但我想事實並非如此。

有人知道這是怎么回事嗎?

Dim inputevents(0) As INPUT_Type   ' holds information about each event

Dim mouseevent As MOUSEINPUT  ' temporarily hold mouse input info

With mouseevent
    .dX = 0  ' no horizontal movement
    .dy = 0  ' no vertical movement
    .mouseData = 0
    .dwFlags = MOUSEEVENTF_LEFTDOWN
    .dwTime = 0  ' use the default
    .dwExtraInfo = 1024 'this is my custom value
End With

' Copy the structure into the input array's buffer.
inputevents(0).dwType = INPUT_MOUSE  ' mouse input
CopyMemory inputevents(0).xi(0), mouseevent, Len(mouseevent)

' Now that all the information for the four input events has been placed
' into the array, finally send it into the input stream.
Dim lRet&
lRet = SendInput(1, inputevents(0), Len(inputevents(0)))

這就是我閱讀Windows消息的方式。 我想我很有經驗,並且總是運行良好:

        Dim nMouseDat As WinSubHook2.tMSLLHOOKSTRUCT   'Low-level mouse data
        'lParam points to the low-level mouse data, copy it to dat
        nMouseDat = hkMs.xMSLLHOOKSTRUCT(lParam)
        'Here nMouseDat.dwExtraInfo should be 1024, but instead it is -11054848

Windows 7為WM_MOUSEFIRSTWM_MOUSELAST范圍內的消息生成額外的消息信息,以允許客戶端查詢鼠標輸入消息的來源。 這樣做的原因是Windows響應於觸摸輸入而生成鼠標輸入,以為未實現專用觸摸支持的應用程序提供最小的支持。

系統事件和鼠標消息中對此進行了記錄。 常量MI_WP_SIGNATURE聲明為0xFF515700 將其轉換為有符號整數,您將得到-11054848

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM