For Run Sound Wave From Resource And Wave File

For Run Sound Wave From Resource And Wave File

Postby HATHAL » Wed Nov 16, 2005 2:07 pm

My Friend View This Source
For Run Sound Wave From Resource And Wave File
Bat Not Compiler With Function hb_parc(1)
Thank For All





// Test Sound Source
#include "FWCE.ch"
//----------------------------------------------------------------------------//
function Main()
local oWnd
DEFINE WINDOW oWnd TITLE "TEST sound "
@1,10 button "Test 1 PLAYWAV()" size 150, 20 action PLAYWAV()
@4,10 button "Test 2 PLAYWAVRES()" size 150, 20 action PLAYWAVRES()
ACTIVATE WINDOW oWnd
return nil
********************************************************
#pragma BEGINDUMP
#include <hbapi.h>
#include <Windows.h>
#include <mmsystem.h>
HMODULE GetResources( void );
extern HINSTANCE GetInstance( void );
void HB_FUN_PLAYWAV()
{
// char cfile * =hb_parc(1);
PlaySound(_T("\\Windows\\Default.wav"), NULL, SND_ASYNC | SND_FILENAME);
// PlaySound( cfile, NULL, SND_ASYNC | SND_FILENAME);
}
void HB_FUN_PLAYWAVRES()
{
// char cfile * =hb_parc(1);
PlaySound (_T("testSound"), GetResources() ? GetResources(): GetInstance(), SND_RESOURCE | SND_ASYNC);
/// PlaySound ( cfile, GetResources() ? GetResources(): GetInstance(), SND_RESOURCE | SND_ASYNC);
// MessageBox( GetActiveWindow(),cfile , _T("VIEW THIS"), 0 );

}
/*
void HB_FUN_PLAYWAVMEM()
{
BYTE buffer[100*1024];
CFile file;
file.Open(_T("\\Windows\\empty.wav"), CFile::modeRead);
file.Read(buffer, 100*1024);
file.Close();

PlaySound((const unsigned short *)buffer, NULL, SND_MEMORY | SND_ASYNC);
}
*/
#pragma ENDDUMP
/*
// FILE TEST_SO.RC //
// SAVE THIS TEXT FOR FILE ( TEST_SO.RC )
// BUT ANY FILE SOUND (SMAIL ONLY) TEST.WAV
// AND Compiler FILE TEST_SO.PRG
testSound WAVE "test.wav"
*/ :)
User avatar
HATHAL
 
Posts: 77
Joined: Tue Nov 15, 2005 3:38 pm
Location: The Kingdom Saudi Arabia -Riyadh

Re: For Run Sound Wave From Resource And Wave File

Postby Enrico Maria Giordano » Wed Nov 16, 2005 4:06 pm

This is a working sample:

Code: Select all  Expand view
#include "Fwce.ch"


FUNCTION MAIN()

    LOCAL oWnd

    DEFINE WINDOW oWnd

    @ 1, 1 BUTTON "&Play";
           SIZE 60, 30;
           ACTION SNDPLAYSOUND( CURDIR() + "\SOUND.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


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8356
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 5 guests