Jump to content

Archived

This topic is now archived and is closed to further replies.

Gregg_Seipp

Help with an MFC Simconnect app

Recommended Posts

Hi,

 

I've made a basic MFC app and hooked up SimConnect.  I used Simconnect_Open, giving it an HWND and user eventId and my event function is getting messages.  I just need to know how to get the simconnect message and data from the wParam and lParam.  Can someone help?  My function is below...

 

Gregg

BEGIN_MESSAGE_MAP(CTestMFCDlg, CDialogEx)
    ON_WM_SYSCOMMAND()
    ON_WM_PAINT()
    ON_WM_TIMER()
    ON_WM_QUERYDRAGICON()
    ON_BN_CLICKED(IDC_APPLY, &CTestMFCDlg::OnBnClickedApply)
    ON_MESSAGE(WM_USER_SIMCONNECT, &CTestMFCDlg::OnSimMsg)
END_MESSAGE_MAP()

LRESULT CTestMFCDlg::OnSimMsg(WPARAM wParam, LPARAM lParam) {
	CString msg;
	msg.Format(_T("Sim Msg: %d"), lParam);
	Log(msg);
        return 0;
}


Gregg Seipp

"A good landing is when you can walk away from the airplane.  A great landing is when you can reuse it."
i7-8700 32GB Ram, GTX-1070 8 Gig RAM

Share this post


Link to post
Share on other sites

Welp, I think I sorted that part out.  I now have a functioning Dispatch proc.  Another issue, though...

 

I have a line in my code which is from the examples...

 

        hr = SimConnect_SubscribeToSystemEvent(hSimConnect, EVENT_SIM_START, "SimStart");

 

First thing, I haven't found any evidence of what "SimStart" is.  Second thing, if the sim is already running, I don't get that event...however, I do get a SIMCONNECT_RECV_ID_OPEN event which I'm not handling. Do I need to handle SIMCONNECT_RECV_ID_OPEN as well...basically, with the same logic I'm using for SimStart? 

 

Gregg


Gregg Seipp

"A good landing is when you can walk away from the airplane.  A great landing is when you can reuse it."
i7-8700 32GB Ram, GTX-1070 8 Gig RAM

Share this post


Link to post
Share on other sites

Clearly, talking to myself here.  Anyway, found the reason why "SimStart" isn't called when the sim is already running.  Still, begs the question as to how to handle the situation when it's already running and my app starts. 

 

Gregg


Gregg Seipp

"A good landing is when you can walk away from the airplane.  A great landing is when you can reuse it."
i7-8700 32GB Ram, GTX-1070 8 Gig RAM

Share this post


Link to post
Share on other sites

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
  • Donation Goals

    AVSIM's 2020 Fundraising Goal

    Donate to our annual general fundraising goal. This donation keeps our doors open and providing you service 24 x 7 x 365. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. We reset this goal every new year for the following year's goal.


    34%
    $8,560.00 of $25,000.00 Donate Now
×
×
  • Create New...