How to use CreateAcceleratorTable API

pcm

New Member
Hi All,

We want to use EditeurX a Text Editor ActiveX. It works fine, but we would like to implement Accelerator Keys and to do that we have to call the control’s SetAccelerators() method, passing a handle to a valid accelerator table that you build using the Win32 API CreateAcceleratorTable.

Here’s how in VB :

==========================================================
Private Const FALT = &H10 ' alt key pressed
Private Const FCONTROL = &H8 ' control key pressed
Private Const FSHIFT = &H4 ' shift key pressed
Private Const FNOINVERT = &H2
Private Const FVIRTKEY = &H1 ' .key is VK_xxx if set else character code
Private Const VK_F1 = &H70 ' virtual key code for F1
Private Const VK_F2 = &H71 ' virtual key code for F2


Private Type ACCEL
fVirt As Byte ' 0, FALT, FCONTROL, FALT+FCONTROL
key As Integer ' VK_xxx virtual key or character code
cmd As Integer ' any event number
End Type

' Setting the accelerators

Dim Accl(2) As ACCEL
Dim hAccl As long

Accl(0).fVirt = VIRTKEY ' Virtual key code
Accl(0).key = VK_F1 ' F1
Accl(0).cmd = 1
Accl(1).fVirt = CONTROL ' Ctrl + character code
Accl(1).key = &H41 ' A
Accl(1).cmd = 2
hAccl = CreateAcceleratorTable(Accl(0), 2)
Me.Editeur1.SetAccelerators (hAccl)

Private Declare Function CreateAcceleratorTable Lib "user32" Alias "CreateAcceleratorTableA" (lpaccl As ACCEL, ByVal cEntries As Long) As Long
==========================================================

How to implement the same thing in Progress ?

Thanks in advance,

pcm
 
Top