Traffic - SimConnect - Removal of

From FSDeveloper Wiki
Revision as of 16:32, 9 August 2011 by BASys (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Placeholder for Traffic SimConnect - Interaction -Removal of related matters.

Transclusion-Traffic-SimConnect-Oneline-Overview

FSX AI Traffic can be created/manipulated/removed through the SimConnect API.

Template

Requires a basic template for pasting into each page.

Removing AI Objects

To remove AI objects, MS TrafficTools calls the following function from the native FSX acontain.dll.


If your program is a *.DLL or module running within FSX, you can call it directly.

If your program is a stand-alone EXE, you require a 3rd party interface to use this function.
e.g. FSUIPC


TODO find WIKITAGS to format correctly. [PRE] // Flightsim calling convention

  1. define FSAPI __stdcall

typedef void (FSAPI *FS10ACONTAINDELETEAIAIRCRAFT)(unsigned long container_id, int arg2);

FS10ACONTAINDELETEAIAIRCRAFT FS10DeleteAIAircraft = NULL;

// Get the handle of the ACONTAIN.DLL module hAContain = GetModuleHandle("ACONTAIN.DLL");

// E) DELETE AN AI AIRCRAFT FROM THE FLIGHT SIMULATOR // If we got the handle of the ACONTAIN.DLL module then if (hAContain != NULL) {

  // Get a pointer to the ACONTAIN.DLL exported function
  FS10DeleteAIAircraft = (FS10ACONTAINDELETEAIAIRCRAFT)GetProcAddress(hAContain, (char*)7);
 // If we got a pointer to the ACONTAIN.DLL module's exported function then

if (FS10DeleteAIAircraft != NULL) {

  // NOTE: The Container ID (CID) is the number in HEXAGESIMAL, located in
  // the first column in the list, of the "Traffic Explorer" window
  //     (of the TrafficToolBox.dll),
  // Delete the AI Aircraft that has the Container ID (CID) of 0x0000000C
  FS10DeleteAIAircraft(0x0000000C, 1);
 // Notify to user
 MessageBox(hWnd, "The AI aircraft with the container ID of: 0x0000000C, had been deleted SUCCESSFULLY!", "Message", 0);

} }

 // Get a pointer to the ACONTAIN.DLL exported function

FS10DeleteAIAircraft = (FS10ACONTAINDELETEAIAIRCRAFT)GetProcAddress(hAContain, (char*)7); [/PRE]