- Messages
- 15
- Country

i got sim connect 64 bit working and get successfully the position of the aircraft. See Http://positiongames.com
Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.
By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.


<DllImport("SimConnect.dll", CallingConvention:=CallingConvention.StdCall, CharSet:=CharSet.Ansi)>
Shared Function SimConnect_AddToDataDefinition(
ByVal hSimConnect As Int32,
ByVal DefineID As Int32,
ByVal DatumName As String,
ByVal UnitsName As String,
ByVal DatumType As Int32,
Optional ByVal fEpsilon As Single = 0,
Optional ByVal DatumID As Int32 = 0) As Int32
End Function
<DllImport("SimConnect.dll", CallingConvention:=CallingConvention.StdCall, CharSet:=CharSet.Ansi)>
Shared Function SimConnect_Open(ByRef hSimConnect As UInt32, ByVal AppName As String, ByVal hWnd As UInt32, ByVal UserEventWin32 As UInt32, ByVal hEventHandle As UInt32, ByVal ConfigIndex As UInt32) As UInt32
End Function
<DllImport("SimConnect.dll", CallingConvention:=CallingConvention.StdCall, CharSet:=CharSet.Ansi)>
Shared Function SimConnect_GetNextDispatch(ByVal hSimConnect As Int32, ByRef ppData As IntPtr, ByRef pcbData As IntPtr) As Int32
End Function
<DllImport("SimConnect.dll", CallingConvention:=CallingConvention.StdCall, CharSet:=CharSet.Ansi)>
Shared Function SimConnect_RequestDataOnSimObject(ByVal hSimConnect As Int32,
ByVal SIMCONNECT_DATA_REQUEST_ID As Int32,
ByVal SIMCONNECT_DATA_DEFINITION_ID As Int32,
ByVal SIMCONNECT_OBJECT_ID As Int32,
ByVal SIMCONNECT_DATA_REQUEST_FLAG As Int32,
ByVal origin As Int32,
ByVal interval As Int32,
ByVal limit As Int32) As Int32
End Function
<DllImport("SimConnect.dll", CallingConvention:=CallingConvention.StdCall, CharSet:=CharSet.Ansi)>
Shared Function SimConnect_RequestDataOnSimObjectType _
(ByVal hSimConnect As UInt32,
ByVal RequestID As Int32,
ByVal DefineID As UInt32,
ByVal dwRadiusMeters As UInt32,
ByVal ObjectType As UInt32) As UInt32
End Function
<DllImport("SimConnect.dll", CallingConvention:=CallingConvention.StdCall, CharSet:=CharSet.Ansi)>
Shared Function SimConnect_Close(ByVal hSimConnect As Int32) As Int32
End Function
Structure SIMCONNECT_RECV_OPEN
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)>
Dim szApplicationName As String
Dim dwApplicationVersionMajor As Int32
Dim dwApplicationVersionMinor As Int32
Dim dwApplicationBuildMajor As Int32
Dim dwApplicationBuildMinor As Int32
Dim dwSimConnectVersionMajor As Int32
Dim dwSimConnectVersionMinor As Int32
Dim dwSimConnectBuildMajor As Int32
Dim dwSimConnectBuildMinor As Int32
Dim dwReserved1 As Int32
Dim dwReserved2 As Int32
End Structure
CopyMemory Recv, ByVal pData, Len(Recv)
pData = pData + Len(Recv)
Recv = Marshal.PtrToStructure(pData, GetType(SIMCONNECT_RECV))
pData = pData + Marshal.SizeOf(Recv)


Could you attach the complete code (or vs project) as a ZIP file?I adopted the code from here http://www.fsdeveloper.com/wiki/index.php?title=SimConnect_-_Accessing_from_VB and successfully connected VB with FSW.



#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include "SimConnect.h"
#include <strsafe.h>
int quit = 0;
HANDLE hSimConnect = NULL;
static enum GROUP_ID {
MyGroup,
};
static enum EVENT_ID {
EVENT_SLEW_ON,
};
void testSendEvent()
{
HRESULT hr;
if (SUCCEEDED(SimConnect_Open(&hSimConnect, "FSW Slew", NULL, 0, 0, 0)))
{
MessageBox(NULL, _T("SimConnected! \n \n Mapping the Client event... \n \n Transmitting the Client event..."), _T(""), MB_OK | MB_SYSTEMMODAL);
hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_SLEW_ON, "SLEW_ON");
hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, MyGroup, EVENT_SLEW_ON);
hr = SimConnect_SetNotificationGroupPriority(hSimConnect, MyGroup, SIMCONNECT_GROUP_PRIORITY_HIGHEST);
SimConnect_TransmitClientEvent(hSimConnect, 0, EVENT_SLEW_ON, 0, SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);
MessageBox(NULL, _T("Slew set!"), _T(""), MB_OK | MB_SYSTEMMODAL);
hr = SimConnect_Close(hSimConnect);
}
}
//int __cdecl _tmain(int argc, _TCHAR* argv[])
// Hides the console window
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
testSendEvent();
return 0;
}