this will set the keys. it assumes that keys you want to set are in key_codes(i) and that the corresponding offsets are put into key_offsets(i)
Public Function set_keycodes()
Dim x As Long
Dim i As Long
Dim k As Long
Dim dwResult As Long
Dim j As Long
Call FSUIPC_Read(&H320C, 4, VarPtr(x), dwResult)
Call FSUIPC_Process(dwResult)
If x = 56 Then
i = 1
For k = &H3210 To &H32F8 Step &H4
Call FSUIPC_Read(k, 4, VarPtr(j), dwResult)
Call FSUIPC_Process(dwResult)
If j = key_codes(i) Then 'can we find our hot key
key_offsets(i) = k
i = i + 1
ElseIf j = 0 And i <= 28 Then 'can't find it, find an empty slot and write it out
Call FSUIPC_Write(k, 4, VarPtr(key_codes(i)), dwResult)
Call FSUIPC_Process(dwResult)
key_offsets(i) = k
If debug_flag Then Debug.Print i, key_offsets(i), key_codes(i)
i = i + 1
End If
If i > 28 Then Exit For 'done entering hot keys
Next k
End If
End Function