2 Replies Latest reply on May 18, 2014 9:17 AM by Nicolas Etienne

    SB1 and C++

    Nicolas Etienne

      Hi

       

      Thanks to Nick PRICE, I know that it is possible to launch an exe program done with visual studio 2008 in C++.

       

      Step 1:

      Create a smart device project with Pocket PC 2003 template... and a console one..

       

      Step 2:

      Put this code...

      MessageBox(NULL,L"ALARME",L"Message",MB_OK);

       

      in the tmain...

       

      In a index.html file, you can put this:

       

      generic.LaunchProcess("\\UserDrive\\apps\\HelloWorld\\nico.exe","");

       

      where nico.exe was the executable create by visual studio.

       

      ---------------------------------------------------------------------

       

      Now, few questions....

       

      It's nice to display a Messagebox, but what if I want to create my own message box ?

       

      I've tried with MFC but it seems that it's not supported by SB1 os ?

       

      So, what should I do in order to make it work ?

       

       

      What is beyond my request:

       

      I'm creating for a customer a program that will alert a user equiped with a SB1 that an alarm occured.

       

      at this time, using the notification Push sample from the toolbox, I'm able to do it... but (because there is always a but in dev...), when my "app" is foreground,

      it's not brought to front... My index.html contains a playFile which is nicely played by the SB1 (so the user is warned) but the User HAS TO PUSH "HOME BUTTON"

      to see the message i've send him...

       

      My wished would be to be able to show him the message without having to press "Home button"...

       

      If I use the C++ program with MessageBox, the message is well displayed but, messagebox look is not nice.. so I want my home message box...

       

      And if I don't use C++ program and launchProcess, I've to push "home"...

       

      So, what should I do to achieve this:

       

      Push notification from PC to SB1 ==> OK

       

      On the SB1:

       

      Play a sound ==> OK

      Show message without any push button or press screen or whatever ==> My question

       

       

      thanks

        • Re: SB1 and C++
          Hayden Eastman

          I'm not sure I completely understand your issue, but it seems that you want to create your own notification window and would like it to be on top of the other open windows.  This can be done via the SetWindowPos function.  If you use HWND_TOPMOST as the hWndInsertAfter parameter, the window will be set on top of all other windows.   Hope this helps

            • Re: SB1 and C++
              Nicolas Etienne

              hI Hayden

               

              I know SetWindowPos will do this...

               

              There is two problems in my question...

               

              First : If I use the javascript function "Alert" in my Html code (based on notification sample provide inside the toolbox), when the SB1 is "sleeping", the alert won't be seen...

              The sound will be played but nothing will be displayed on the screen..

               

              I've noticed that when a start a Exe with a MEssagebox inside, this time, by doing generic.launchProcess during the notification event, I still will have the sound + the MessageBox

              will be displayed..

               

              So, to solve my problem, I have two choices...

               

              First : If it's possible to make the javascript alert method displayed even when the SB1 is "asleep", that will be great... but did not find anything to achieve this

               

              Second: Continue digging in the way of using LaunchProcess with a C++ Exe... but, at this time, I've been able to use Messagebox, but not but able to create a C++ Exe that

              will display a "full screen" dialog with my message and a button to just say yes... (because the messagebox is really to small and the "ok button" on the right corner is really

              to ulgy to say that it is a convenient solution...

               

              That's why I'm asking help.

               

              The "best" solution would be to have a C++ Exe which will only displayed a windows (with button and text passed through argument of the main)... But, right now, I've tried

              to create a MFC smart device ==> Didn't work on the SB1...

               

              So, if you have "code" to just create a window with the "same behavior" as a messagebox but without the drawback of the ok button and the size, I'll take it with happyness..

               

              Nicolas,

               

              Toulouse, France