Sample: OpenClose.cpp
//------------------------------------------------------------------------------ // // SimConnect Open and Close Sample // // Description: // Opens and immediately Closes SimConnect //------------------------------------------------------------------------------ #include <windows.h> #include <tchar.h> #include <stdio.h> #include <strsafe.h> #include "SimConnect.h" HANDLE hSimConnect = NULL; void testOpenClose() { HRESULT hr; if (SUCCEEDED(SimConnect_Open(&hSimConnect;, "Open and Close", NULL, 0, 0, 0))) { printf("\nConnected...!"); hr = SimConnect_Close(hSimConnect); printf("\nDisconnected...!"); } else printf("\nFailed to connect..."); } int __cdecl _tmain(int argc, _TCHAR* argv[]) { testOpenClose(); return 0; } |