0
0

Hi all together!
Firstly, I’m a newbe at FMOD.
Now my problem: I’m writing a tool that plays a soundfile on keyup (hooking). Thus, I have to create a DLL that plays the sound.
In the DllEntryPoint I call FSOUND_Init and at that point the application hang up. If I call it later (perhabs in the hookprocedure) it works. But I don’t want to initialize the System on each keypress.
My question: Why does it hang up?

Here a very simple example:

Hostprogram:
[code:1oej6lc7]#include <windows.h>

int main(void) {
HINSTANCE hLib = LoadLibrary("test.dll");
MessageBox(0,"Code will never reach here!",0,0);
return 0;
}
[/code:1oej6lc7]

DLL:
[code:1oej6lc7]#include <windows.h>

include <FMOD/fmod.h>

extern "C" {

__declspec(dllexport) BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
MessageBox(0,"Loading FMOD",0,0);
FSOUND_Init(44100,32,0);
MessageBox(0,"FMOD loaded!",0,0);
break;

  case DLL_PROCESS_DETACH:
    FSOUND_Close();
    break;

  case DLL_THREAD_ATTACH:
    break;

  case DLL_THREAD_DETACH:
    break;
}

/* Returns TRUE on success, FALSE on failure */
return TRUE;

}

}[/code:1oej6lc7]

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.