devxlogo

More Tips for “Creating a Better Mouse Trap”

More Tips for “Creating a Better Mouse Trap”

I would like to add a few things to the “Building a Better Mouse Trap” tip [VBPJ November 1996, page 56]. This approach also works for any message, including button-up and button-down messages. Windows 95 calls the appropriate function and passes the mouse coordinates and other information in lParam and wParam, which, in the case of the MouseMove event, VB converts to the Button, Shift, X, and Y arguments. If the user clicks on the icon in the system tray, Windows passes 513 and 514 (WM_LBUTTONDOWN and WM_LBUTTONUP) to VB, and VB performs a conversion that leaves the original mouse message in X. If ScaleMode of the invisible form, frmOmni in the example, is left as Twips, this tip won’t work for every system. To make this tip work on every system, set ScaleMode of the invisible form to Pixels.

devx-admin

Share the Post: