Jump to content
The simFlight Network Forums

HOT KEY creation and access with FSUIPC and VB

Recommended Posts

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.