我希望檢測當前螢屏究竟是通過滑鼠點擊而執行 Click 事件的,還是通過觸摸屏觸擊的。這樣,當用戶點擊滑鼠時,跳出較小的選單。當用戶觸摸螢屏時,顯示較大的選單按鈕。那 VB6 應該怎么做到區別呢?謝謝!
uj5u.com熱心網友回復:
應用層面應該是無法判斷的, 因為觸摸屏在系統上就是一個和滑鼠類似的輸入設備.估計你得從驅動之類的入手了. 但是這很難.
折中一下吧: 來一個中號的選單吧, 無論滑鼠還是觸摸屏都一樣
uj5u.com熱心網友回復:
沒有區別。硬體上可以同時用觸屏、滑鼠,軟體上都是滑鼠操作。
可以加個啟動歡迎畫面、讓用戶在大小兩套風格中選一個。
uj5u.com熱心網友回復:
前不久剛搞過觸摸屏的 c++ 專案看你是用什么芯片的觸摸屏了
或者你可以試試用 eGalaxTouch 的驅動,這個是觸摸屏的通用驅動,不分廠家
驅動里面有一個二次開發庫,可以讓你的程式接收觸摸資訊而不會把觸摸資訊直接轉換成滑鼠資訊
使用開發包里面的函式 RegisterTPNotifyMessage,注冊視窗資訊接收
RegisterTPNotifyMessage
DWORD WINAPI
RegisterTPNotifyMessage(
HANDLE hFile,
HWND hWnd,
UINT imsg
);
RegisterTPNotifyMessage registers a notification message for touch event so that the window can receive the message whenever touch event happens.
Parameters
hFile
Device handle obtained by CreateDevice
hWnd
Target window to receive the caller defined message when touch event happened.
imsg
Caller defined message.
Remark
The Target window will receive the caller defined message whenever the touchscreen
was touched. With this caller defined message, wParam is the touch proximity state, LOWORD( lParam) is X coordination, and HIWORD(lParam) is Y coordination. The coordination data is always scaled to 0~65535 for the driver before version 5.0.1.5310. When working with driver version 5.0.1.5310 or later, the coordination data is not scaled. Instead, the value range depends on the AD resolution shown in wParam.
The window can receive the caller defined message only when the device thread was started with StartDeviceThread.
Driver, version 5.0.1.5310 or later, supports multiple ADC resolution, multi-user, pressure. Such information can be obtained in wParam
wParam is a 32 bits data described as below
B31 B24 B23 B16
Player ID
pressure
B15~B8
0
Z
M
0
0
AD1
AD0
Status
Z = 1, B16~B23 is 8 bits pressure information
M= 1, B24~B31 is 8 bits multi-user player ID
AD1:AD0 = resolution of the coordination data.
AD1:AD0 = 0:0 11 bits resolution
AD1:AD0 = 0:1 12 bits resolution
AD1:AD0 = 1:0 13 bits resolution
AD1:AD0 = 1:1 14 bits resolution
See Also
RegisterDeviceRemovalHook
uj5u.com熱心網友回復:
至于這個開發包能不能支持 vb 我就不知道了但是運行它需要用到 mfc 的庫
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/108095.html
標籤:API
