🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
7 messages
7 total messages Started by Oren Halvani Tue, 12 Sep 2006 11:28
Playing a mp3 via mciSendString from Resource ?
#3020
Author: Oren Halvani
Date: Tue, 12 Sep 2006 11:28
17 lines
1267 bytes
dear builders,

can someone tell me if it's possible to use mciSendString
for playing a MP3 from resource that is build-in the application ??


thanks for any hint on this...



Oren

/*******************************************************/
void __fastcall TfrmMainUnit::Button1Click(TObject *Sender)
{
   mciSendString( "play MP3_FROM_RESOURCE", NULL, 0, NULL);
} 
Re: Playing a mp3 via mciSendString from Resource ?
#3021
Author: Remy Lebeau (TeamB)
Date: Tue, 12 Sep 2006 17:01
11 lines
1219 bytes
"Oren Halvani" <Spam@halvani.de> wrote in message
news:450699fa@newsgroups.borland.com...

> can someone tell me if it's possible to use mciSendString
> for playing a MP3 from resource that is build-in the application ??

It is not.  MCI does not support playing anything from resources directly.


Gambit
Re: Playing a mp3 via mciSendString from Resource ?
#3023
Author: Oren Halvani
Date: Tue, 12 Sep 2006 18:12
24 lines
1735 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> schrieb im Newsbeitrag
 news:4506e869$1@newsgroups.borland.com...
>
> "Oren Halvani" <Spam@halvani.de> wrote in message
> news:450699fa@newsgroups.borland.com...
>
>> can someone tell me if it's possible to use mciSendString
>> for playing a MP3 from resource that is build-in the application ??
>
> It is not.  MCI does not support playing anything from resources directly.
>
>
> Gambit

Thanks Remy :-)

i will save the mp3 file from resouce and than use the mciSendString...
but only one more thing: What should i do if i want to load the required DLL
"WinMM.dll" via LoadLibrary( ) can u show me how to call the DLL-Entry address...?



Oren 
Re: Playing a mp3 via mciSendString from Resource ?
#3024
Author: Remy Lebeau (TeamB)
Date: Tue, 12 Sep 2006 19:59
17 lines
1424 bytes
"Oren Halvani" <Spam@halvani.de> wrote in message
news:4506f88a@newsgroups.borland.com...

> What should i do if i want to load the required DLL "WinMM.dll"
> via LoadLibrary( )

What about it?  What exactly do you want to do?  Why are you trying to load
WinMM.DLL manually anyway?

> can u show me how to call the DLL-Entry address...?

You never call a DLL's entry point yourself.  It is called automatically by
the DLL loader.  In the case above, by LoadLibrary().


Gambit
Re: Playing a mp3 via mciSendString from Resource ?
#3025
Author: Oren Halvani
Date: Tue, 12 Sep 2006 20:51
63 lines
2566 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> schrieb im Newsbeitrag
 news:45071353@newsgroups.borland.com...


> What about it?  What exactly do you want to do?  Why are you trying to load
> WinMM.DLL manually anyway?


Because i don't want my programm to be depend directly to the "WinMM.DLL"
if it's existing, otherwise my programm would be directly "linked" to the DLL...
Only if the DLL is there, than the programm should use its function: "mciSendDtring",


> You never call a DLL's entry point yourself.  It is called automatically by
> the DLL loader.  In the case above, by LoadLibrary().
>
>
> Gambit

sorry, no "entry point"...my mistake.....i mean: GetProcAddress( ) ....

how should i call:

        GetProcAddress((HMODULE)hInstance, "Name_Of_Dll_Function");


i remember, i've used something similar in the past....


in header...
-------------------------------------------------------------------------
private:
   typedef int (DLLFUNCTION)(int, int);

   DLLFUNCTION   *WinMM_DllFunction;

public:
    TDLLTest();
    void CallDllFunction(int iTest1, int iTest2);
}

// in cpp....


TDLLTest::TDLLTest( )
{
   HINSTANCE hInstance;

   hInstance = ::LoadLibrary("DelphiDLL.dll");
   WinMM_DllFunction  = (DLLFUNCTION*)::GetProcAddress((HMODULE)hInstance, "Name_Of_Dll_Function");
}

void TDLLTest::CallDllFunction(int iTest1, int iTest2)
{
    int iResult;

    if (WinMM_DllFunction)  iResult = (*WinMM_DllFunction)(iTest1, iTest2);
}
-------------------------------------------------------------------------



Oren 
Re: Playing a mp3 via mciSendString from Resource ?
#3026
Author: Remy Lebeau (TeamB)
Date: Tue, 12 Sep 2006 21:40
46 lines
2398 bytes
"Oren Halvani" <Spam@halvani.de> wrote in message
news:45071dcf@newsgroups.borland.com...

> Because i don't want my programm to be depend directly
> to the "WinMM.DLL" if it's existing

Why not?  That is a Microsoft DLL that is on all Windows systems.  Since you
are using the Windows Multimedia system anyway, you are better off
statically linking to it.  There is no point in dynamically loading it in
your code.

> otherwise my programm would be directly "linked" to the DLL...

As it should be.  That DLL is always available.

> Only if the DLL is there

The DLL is part of the Windows OS, and has been since the days of Windows 95
and NT 3.1.  It is been available on all Sindows systems ever since.

> how should i call:
>
>         GetProcAddress((HMODULE)hInstance, "Name_Of_Dll_Function");
>
>
> i remember, i've used something similar in the past....

That is how to dynamically load a DLL function.  So what exactly are you
having a problem with?  Please be more specific.

>    typedef int (DLLFUNCTION)(int, int);

Use a pointer in the typedef, not in the variable declarations:

    typedef int (*DLLFUNCTION)(int, int);

    DLLFUNCTION WinMM_DllFunction;

    WinMM_DllFunction  = (DLLFUNCTION) ::GetProcAddress(hInstance,
"Name_Of_Dll_Function");

    iResult = WinMM_DllFunction(iTest1, iTest2);


Gambit
Re: Playing a mp3 via mciSendString from Resource ?
#3027
Author: Oren Halvani
Date: Tue, 12 Sep 2006 22:09
27 lines
1786 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> schrieb im Newsbeitrag
news:450729d7$1@newsgroups.borland.com...


> Why not?  That is a Microsoft DLL that is on all Windows systems.  Since you
> are using the Windows Multimedia system anyway, you are better off
> statically linking to it.  There is no point in dynamically loading it in
> your code.
>
>> otherwise my programm would be directly "linked" to the DLL...
>
> As it should be.  That DLL is always available.


Well, actually you've answered my question :-)

i'll link my program staticly without LoadLibrary(...)

if the DLL is installed by default, i really don't need to call
it dynamicly at all....


thanks Remy !!!



Oren 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads