**HELP** Where did I go wrong here??
OK, I've posted this twice now, but have received no reply's. Perhaps
my phrasing was incorrect.
I'm trying to incorperate a DLL in my application. The DLL has all of
the capabilities to play MOD files, so that I can spice up the
background sounds of my app (Kids Games/Strategy Games) without the
use of size costly Redbook Audio.
Each time I try to access the DLL, My system resets. I know the
problem is something in the way I call the DLL, Since I am using a few
other applications that successfully use the dll, and it works fine.
Can someone please check this code, and the DLL headers ( available at
http://www.jps.net/olivierl), and let me know here I botched this all
up?? I'm pushing a deadline here, and would like to see this working.
The code .....
{.........Assume Standard .PAS file headers to this point..........}
implementation
{$R *.DFM}
{OK.. we insert the code for th DLL interface here..}
{Here's the C++ Prototype for the function Call}
{LPVOID WINAPI ModPlug_CreateEx(LPCSTR lpszParams)}
function ModPlug_CreateEx(lpszParams : PChar) : PChar; far ; external
'npmod32.dll';
{This has had a tendancy to crash...}
procedure TForm1.FormCreate(Sender: TObject);
begin
edit1.text := 'This should receive the ModPlug.DLL return Data';
end;
procedure TForm1.Button1Click(Sender: TObject);
var
RetCode : Integer;
Source, Dest : PChar;
MyStr : String;
begin
{Define the params to send the DLL}
MyStr := 'src|aryx.mdz|autostart|true|';
{Allocate Space For a NT String}
Source := StrAlloc(100);
{Convert the String to a NT String}
StrPCopy(Source, MyStr);
{Pass The String to the DLL and return the Result to the Edit Box}
Edit1.text := StrPas(ModPlug_CreateEx(Source));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Application.Terminate;
end;
Can some kind soul look this over and point me in the right
direction..
Thanks in advance
Jerry Russell
dark_...@c-zone.net
pixs...@nstate.net