Click length in Embedded Visual Basic and press OK

Source: Internet
Author: User

On the new Pocket PC device, you can click and hold to confirm the operation. This is a great way to show your application what operations are being performed. However, when you use Microsoft Embedded Visual Basic

Click length and press OK. You must add this support by yourself.

First, you need to capture the window messages sent to each control (the most important is the wm_lbuttondown message ). You can achieve this by using third-party controls such as messagece. Then, you need to use the Windows CE API

Shrecognizegesture. This API processes the display of the confirmation process (a circle of red dots is displayed clockwise during the long-pressed operation) and returns the result code, used to indicate whether the user has been holding the pen for a long enough time.

 

'Let's take a look at the core part of the click-long confirmation code. As I mentioned, you need to declare the shrecognizegesture API: <br/> Public declare function shrecognizegesture lib "aygshell" (byval shrginfo as string) as long </P> <p> 'you also need to declare some API constants: <br/> Public const shrg_returncmd = & H1 </P> <p> Public const gn_contextmenu = 1000 </P> <p> 'Below is the function for capturing long-pressed clicks: <br/> Public Function iscontextmenugesture (byval hwnd as long, byval X as <br/> single, byval y as single) as Boolean </P> <p> dim lsshrgin Fo as string </P> <p> lsshrginfo = longtobytes (20) & longtobytes (hwnd) & _ <br/> longtobytes (x) & longtobytes (y) & _ <br/> longtobytes (shrg_returncmd) </P> <p> iscontextmenugesture = (gn_contextmenu = _ <br/> shrecognizegesture (lsshrginfo )) </P> <p> end function </P> <p> 'You can see that I am simulating a shrginfo structure by adding a member value to the string. The shrginfo structure is as follows: <br/> typedef struct tagshrgi {<br/> DWORD cbsize; <br/> hwnd hwndclient; <br/> point ptdown; <br/> DWORD dwflags; <br/>} shrginfo, * pshrginfo; <br/>

 

In a simulated structure (such as a string), I set the handle and coordinates of the window to the corresponding member of the structure. If the user presses the pen for a long enough time, the shrg_returncmd value of the dwflags member will notify the API to return a gn_contextmenu value.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.