SimConnect - Accessing from VB
From FSDeveloper Wiki
Introduction
The SimConnect documentation states that you must use C or C++ to access SimConnect, unless you use the managed API, in which case you can use any of the Microsoft .Net language compilers. However I have found, after a bit of experimentation, that you can access the non-managed SimConnect API from VB and VBA, using appropriate DECLARE statements.
Below are the DECLARE statements I have written so far, with example calls. Others can contribute to this section as well, until the entire API is covered.
Note : to make these work, you'll have to place a copy of SimConnect.dll somewhere where VB can find it, or else specify the path to it directly in the Declare statement
Declare Statements
Declare Function SimConnect_Open Lib "SimConnect.dll" _
(phSimConnect As Long, _
ByVal szName As String, _
ByVal hWnd As Long, _
ByVal UserEventWin32 As Long, _
ByVal hEventHandle As Long, _
ByVal ConfigIndex As Long) As Long
Declare Function SimConnect_GetNextDispatch Lib "SimConnect.dll" _
(ByVal hSimConnect As Long, _
ppData As Long, _
pcbData As Long) As Long
Declare Function SimConnect_AddToDataDefinition Lib "SimConnect.dll" _
(ByVal hSimConnect As Long, _
ByVal DefineID As Long, _
ByVal DatumName As String, _
ByVal UnitsName As String, _
Optional ByVal DatumType As Long, _
Optional ByVal fEpsilon As Single, _
Optional ByVal DatumID As Long) As Long
Declare Function SimConnect_RequestDataOnSimObjectType Lib "SimConnect.dll" _
(ByVal hSimConnect As Long, _
ByVal RequestID As Long, _
ByVal DefineID As Long, _
ByVal dwRadiusMeters As Long, _
ByVal ObjectType As Long) As Long
Declare Function SimConnect_Close Lib "SimConnect.dll" (ByVal hSimConnect As Long) As Long