Sign in to follow this  
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;
}

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

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

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this