#include "Fwce.ch"
FUNCTION MAIN()
LOCAL oWnd
DEFINE WINDOW oWnd
@ 1, 1 BUTTON "Play";
SIZE 60, 30;
ACTION SNDPLAYSOUND( CURDIR() + "\TEST.WAV" )
ACTIVATE WINDOW oWnd
RETURN NIL
#pragma BEGINDUMP
#include "windows.h"
#include "mmsystem.h"
#include "hbapi.h"
LPWSTR AnsiToWide( LPSTR );
HB_FUNC( SNDPLAYSOUND )
{
LPWSTR pW = AnsiToWide( hb_parc( 1 ) );
hb_retnl( sndPlaySound( pW, hb_parni( 2 ) ) );
hb_xfree( pW );
}
#pragma ENDDUMP
HB_FUNC( SNDPLAYRESOURCE )
{
LPWSTR pW1 = AnsiToWide( IF( ISNUM( 1 ), ( LPSTR ) hb_parnl( 1 ), hb_parc( 1 ) ) );
LPWSTR pW2 = AnsiToWide( "WAVE" );
LPWSTR pW3;
HGLOBAL hglb = LoadResource( GetResources(),
FindResource( GetResources(), pW1, pW2 ) );
pW3 = AnsiToWide( ( LPSTR ) LockResource( hglb ) );
hb_retl( sndPlaySound( pW3, IF( PCOUNT() > 1, hb_parni( 2 ), SND_ASYNC ) | SND_MEMORY | SND_NODEFAULT ) );
hb_xfree( pW1 );
hb_xfree( pW2 );
hb_xfree( pW3 );
UnlockResource( hglb );
FreeResource( hglb );
}
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
LPWSTR AnsiToWide( char * );
HMODULE GetResources( void );
HB_FUNC( SNDPLAYRESOURCE )
{
LPWSTR pW1 = AnsiToWide( ISNUM( 1 ) ? ( LPSTR ) hb_parnl( 1 ) : hb_parc( 1 ) );
LPWSTR pW2 = AnsiToWide( "WAVE" );
LPWSTR pW3;
HGLOBAL hglb = LoadResource( GetResources(),
FindResource( GetResources(), pW1, pW2 ) );
pW3 = AnsiToWide( ( LPSTR ) LockResource( hglb ) );
hb_retl( sndPlaySound( pW3, ( ( hb_pcount() > 1 ) ? hb_parni( 2 ) : SND_ASYNC ) | SND_MEMORY | SND_NODEFAULT ) );
hb_xfree( pW1 );
hb_xfree( pW2 );
hb_xfree( pW3 );
}
#pragma ENDDUMP
#include <windows.h>
extern "C"
{
HINSTANCE GetResources( void );
unsigned short * AnsiToWide( char * );
};
HINSTANCE GetResources( void )
{
return ::GetResources();
}
unsigned short * AnsiToWide( char * p )
{
return ::AnsiToWide( p );
}
Return to FiveWin for Pocket PC
Users browsing this forum: No registered users and 4 guests