System hotkeys in Pb (regardless of whether the window has focus)

Source: Internet
Author: User

 

-- Flystone sorting

 

First define the API

 

  1. Function Integer globaladdatom (ref string lpstring) Library "kernel32.dll" alias for "globaladdatoma"
  2. Function ulong registerhotkey (ulong hwnd, ulong ID, ulong fsmodifiers, ulong VK) Library "user32.dll"

Define variables:

 

 

 

  1. Constant integer mod_alt = 1
  2. Constant integer mod_control = 2
  3. Constant integer mod_shift = 4
  4. Int atomid [11] // used to place the hotkey ID

Register the hotkey, for example, in the opem event:

 

  1. Long ll_rc
  2. String ls_str [11]
  3. Ls_str [1] = "My atom id0"
  4. Atomid [1] = globaladdatom (ls_str [1]) // obtain a unique ID to avoid conflict with other applications.
  5. Ll_rc = registerhotkey (handle (this), atomid [1], 0, 48) // 0
  6. Ls_str [2] = "My atom id1"
  7. Atomid [2] = globaladdatom (ls_str [2]) // obtain the unique ID
  8. Ll_rc = ll_rc + registerhotkey (handle (this), atomid [2], 0, 49) // 1
  9. Ls_str [3] = "My atom Id2"
  10. Atomid [3] = globaladdatom (ls_str [3]) // obtain the unique ID
  11. Ll_rc = ll_rc + registerhotkey (handle (this), atomid [3], 0, 50) // 2
  12. Ls_str [4] = "My atom ID3"
  13. Atomid [4] = globaladdatom (ls_str [4]) // obtain the unique ID
  14. Ll_rc = ll_rc + registerhotkey (handle (this), atomid [4], 0, 51) // 3
  15. Ls_str [5] = "My atom ID4"
  16. Atomid [5] = globaladdatom (ls_str [5]) // obtain the unique ID
  17. Ll_rc = ll_rc + registerhotkey (handle (this), atomid [5], 0, 52) // 4
  18. Ls_str [6] = "My atom id5"
  19. Atomid [6] = globaladdatom (ls_str [6]) // obtain the unique ID
  20. Ll_rc = ll_rc + registerhotkey (handle (this), atomid [6], 0, 53) // 5
  21. Ls_str [7] = "My atom id6"
  22. Atomid [7] = globaladdatom (ls_str [7]) // obtain the unique ID
  23. Ll_rc = ll_rc + registerhotkey (handle (this), atomid [7], 0, 54) // 6
  24. Ls_str [8] = "My atom id7"
  25. Atomid [8] = globaladdatom (ls_str [8]) // obtain the unique ID
  26. Ll_rc = ll_rc + registerhotkey (handle (this), atomid [8], 0, 55) // 7
  27. Ls_str [9] = "My atom id8"
  28. Atomid [9] = globaladdatom (ls_str [9]) // obtain the unique ID
  29. Ll_rc = ll_rc + registerhotkey (handle (this), atomid [9], 0, 56) // 8
  30. Ls_str [10] = "My atom id9"
  31. Atomid [10] = globaladdatom (ls_str [10]) // obtain the unique ID
  32. Ll_rc = ll_rc + registerhotkey (handle (this), atomid [10], 0, 57) // 9
  33. Ls_str [11] = "My atom idx"
  34. If ll_rc <10 then // modify it here
  35. MessageBox ("error", "error message ")
  36. End if

 

Respond to othwe events:

 

  1. If wparam = atomid [1]... then
  2. // MessageBox ('', 'asdf ')
  3. // Your script
  4. End if

 

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.