diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2013-01-27 11:53:54 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2013-01-27 11:53:54 +0000 |
commit | f7f30fa3b0935baa4fdd833a697c9c46a8f09dfd (patch) | |
tree | 4ae93d0839391e8ee63601d50b9faf8849dddec1 | |
parent | 7a8e5bdaae7e8824533657a2ead89179dc17c5a2 (diff) |
Send message to main-window, to display connected-game-name.
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@238 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
-rw-r--r-- | FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp | 8 | ||||
-rw-r--r-- | FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.h | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp index ed8a79ab..7ca38e64 100644 --- a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp +++ b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp @@ -59,6 +59,7 @@ FTNoIR_Protocol::FTNoIR_Protocol() ProgramName = "Microsoft FSX";
blnSimConnectActive = false;
hSimConnect = 0;
+ hMainWindow = 0;
}
/** destructor **/
@@ -97,6 +98,7 @@ void FTNoIR_Protocol::loadSettings() { // Update Headpose in Game.
//
void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
+PDWORD_PTR MsgResult = 0;
virtSCRotX = -1.0f * headpose->pitch; // degrees
@@ -126,6 +128,9 @@ void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData ////hr = SimConnect_SetInputGroupState(hSimConnect, INPUT0, SIMCONNECT_STATE_ON);
blnSimConnectActive = true;
+ if (hMainWindow != NULL) {
+ SendMessageTimeout( (HWND) hMainWindow, RegisterWindowMessageA(FT_PROGRAMID), 0, 0, 0, 2000, MsgResult);
+ }
}
}
else {
@@ -169,6 +174,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle ) HANDLE hctx;
ULONG_PTR ulCookie;
+ hMainWindow = handle;
qDebug() << "SCCheckClientDLL says: Starting Function";
@@ -368,7 +374,7 @@ void CALLBACK FTNoIR_Protocol::processNextSimconnectEvent(SIMCONNECT_RECV* pData //
void FTNoIR_Protocol::getNameFromGame( char *dest )
{
- sprintf_s(dest, 99, "FSX");
+ sprintf_s(dest, 99, "Microsoft FSX");
return;
}
diff --git a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.h b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.h index 65e523ef..42eca457 100644 --- a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.h +++ b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.h @@ -60,6 +60,7 @@ typedef HRESULT (WINAPI *importSimConnect_AddClientEventToNotificationGroup)(HAN typedef HRESULT (WINAPI *importSimConnect_SetNotificationGroupPriority)(HANDLE hSimConnect, SIMCONNECT_NOTIFICATION_GROUP_ID GroupID, DWORD uPriority);
static const char* SC_CLIENT_FILENAME = "SimConnect.dll";
+static const char* FT_PROGRAMID = "FT_ProgramID"; // For message to FaceTrackNoIR main-window.
enum GROUP_ID
{
@@ -112,6 +113,7 @@ private: static float prevSCRotZ;
bool blnSimConnectActive;
+ HANDLE hMainWindow; // Save the handle to FaceTrackNoIR main-window
importSimConnect_Open simconnect_open; // SimConnect function(s) in DLL
importSimConnect_Close simconnect_close;
|