On Thu, 26 Nov 2009, AbeB wrote:
> Does TONE() work on WinCE for anyone? (dosn't work for me)

TONE() is implemented by GT subsystem so the most important question
is which GT you are using in your applications.

In WinCE builds Beep() WIN API function is used for Harbour TONE() function
in the following GTs: GTWIN, GTWVT, GTGUI.
If it works or not depends on used hardware and system.

> how about PlaySound()
> this is what i have  in test.prg
> -----------------------
> Proc main()
> PLAYSOUND( ".\SOUND_OK.WAV")
> #PRAGMA BEGINDUMP
> #include <windows.h>
> #include <mmsystem.h>
> #include <hbapi.h>
> HB_FUNC( PLAYSOUND )
> {
>    hb_retl( PlaySound( hb_parc(1), NULL,SND_ASYNC | SND_FILENAME ) );
> }
> #PRAGMA ENDDUMP
> ----------------------
> warning: passing argument 1 of 'PlaySound' from incompatible pointer type

Very good warning - this code really uses incompatible pointer.
It should be fixed for all windows builds to be compatible with UNICODE
WIN API. In WinCE only UNICODE API exists.
Here is modified version which should work with all windows version.
It needs current SVN code.

   #include <windows.h>
   #include <mmsystem.h>
   #include "hbapistr.h"
   #include "hbset.h"

   #ifdef UNICODE
      #define HB_PARSTR( n, s, l )  \
                           hb_parstr_u16( n, HB_CDP_ENDIAN_NATIVE, s, l )
   #else
      #define HB_PARSTR( n, s, l )  hb_parstr( n, hb_setGetOSCP(), s, l )
   #endif

   HB_FUNC( PLAYSOUND )
   {
      LPCTSTR lpStr;
      void * hStr;

      hStr = HB_PARSTR( 1, &lpStr, NULL );
      hb_retl( hStr && PlaySound( lpStr, NULL, SND_ASYNC | SND_FILENAME ) );
      hb_strfree( hStr );
   }

I haven't tested it. Just written.

best regards,
Przemek
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to