I want the use wave files

User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Salvador,

Prueba a cambiar esta línea:

pW3 = AnsiToWide( ( LPSTR ) LockResource( hglb ) );

por:

pW3 = AnsiToWide( ( LPSTR ) hglb );
regards, saludos

Antonio Linares
www.fivetechsoft.com
Salvador
Posts: 142
Joined: Sun Dec 18, 2005 3:18 pm
Location: España

Post by Salvador »

Antonio,
De esta manera funciona:

Code: Select all

LPWSTR AnsiToWide( LPSTR );

HB_FUNC( PLAYSOUNDRESOURCE ) 
{ 
   LPWSTR pW = AnsiToWide( hb_parc( 1 ) ) ; 
        
   hb_retl( PlaySound( pW,  GetModuleHandle(NULL), ( ( hb_pcount() > 1 ) ? hb_parni( 2 ) : SND_ASYNC ) | SND_RESOURCE |    SND_NODEFAULT ) ); 
                      
} 
Gracias.
Saludos
Salvador
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Salvador,

Hace falta una última llamada a hb_xfree( pW ); para liberar la memoria creada.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Salvador
Posts: 142
Joined: Sun Dec 18, 2005 3:18 pm
Location: España

Post by Salvador »

Ok, gracias
Saludos
Salvador
Post Reply