bluetoothengine/bthid/mouse/hidmousedriver/src/mouse.cpp
changeset 40 997690c3397a
parent 17 f05641c183ff
--- a/bluetoothengine/bthid/mouse/hidmousedriver/src/mouse.cpp	Fri Jun 11 13:48:51 2010 +0300
+++ b/bluetoothengine/bthid/mouse/hidmousedriver/src/mouse.cpp	Wed Jun 23 18:23:52 2010 +0300
@@ -183,10 +183,7 @@
 void CHidMouseDriver::LaunchApplicationL(const TDesC& aName)
     {
     //Check if application is already running in the background
-    TApaTaskList tasks( iWsSession );
-    TApaTask task = tasks.FindApp( aName );
-
-    if ( task.Exists() )
+    if (IsAlreadyRunning())
         {
         // Application is active, so just bring to foreground
         }
@@ -208,6 +205,32 @@
         CleanupStack::PopAndDestroy(2);
         }
     }
+
+TBool CHidMouseDriver::IsAlreadyRunning()
+    {
+    TFindProcess processFinder(_L("*[2001fe5c]*")); //search by paintcursor.exe UID3  
+
+    TBool found = EFalse;
+    TFullName result;
+    if (processFinder.Next(result) == KErrNone)
+        {
+        DBG(RDebug::Print(_L("[BTHID] CHidMouseDriver::IsAlreadyRunning - process found Inside while")) );
+        found = ETrue;
+        }
+
+    if (found)
+        {
+        DBG(RDebug::Print(_L("[BTHID] CHidMouseDriver::IsAlreadyRunning - Process found ")) );
+        }
+    else
+        {
+        DBG(RDebug::Print(_L("[BTHID] CHidMouseDriver::IsAlreadyRunning - Process was never found")) );
+        }
+        
+    return found;
+}
+
+
 // ----------------------------------------------------------------------
 // CHidDriver mandatory functions:
 
@@ -231,6 +254,7 @@
                          _L("[BTHID]\tCHidMouseDriver::DataIn() ECursorRedraw ||ECursorReset ")) );
                 }
 
+            LaunchApplicationL(KAppName);
 
             CursorRedraw();