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
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.