wp83ec5f64.png
wpcff022fe.png
wpe05f0f24.png
wp7bd4f988.png
wp3a644f2b.png
wp794b7de1.png
wp6b867d8f.png
wpbe4b707d.png

 

System Wide Hot Key
by Ken Knight

I needed the ability to have an application event triggered by a hot key regardless of whether my app was active, MS Word or whatever.  Bottom line was the event needed to be fired.

 

So, my years with Delphi said that there was a simple solution beginning with the Windows API call “RegisterdHotKey()”.  Wonderful, now I need to figure how to make this call from within WinDev.  This is where the trouble began.  To be frank, the trouble was with me not paying attention.  Imagine that.

 

To make API calls in WinDev you have to use a special function called API().  It pays to read the help file with extreme focus especially when it comes to callbacks and pointers.

 

So without further ado, let’s jump into it.

 

To begin with we need to declare some external files.  Start by creating a new Project.  For this example we’ll call this project “SystemHotKey”.  This project will not have an analysis.  Go ahead an create a blank window and then click on the main SystemHotKey project window and right click and choose code.

 

In the “Initialization of . . .” section copy and paste the following code.

 

 

 

 

 

 

 

By the way, we will be assigning the F9 key for this tutorial.  You can change this by modifying the variable “vk” in the next section to whatever you’d like.

 

Next Page

wpe545bef4.png

 

EXTERN "WINCONST.WL"

EXTERN "KeyConst.WL"