AFAIK my media files are placed correctly. (Clootie DX 9/Samples/Samples/Media).
The other samples work correctly so i guess there is nothing wrong with the media.

I tried to debug the application and i found out the following.

The OncreateDevice callback in the BasicHLSL unit failed.
This is because following call failed too:

[pascal]
Result := CDXUTDirectionWidget.StaticOnCreateDevice(pd3dDevi ce);
[/pascal]

I continued and found out the following:

[pascal]
class function CDXUTDirectionWidget.StaticOnCreateDevice(
pd3dDevice: IDirect3DDevice9): HRESULT;
var
rgdwAdjacency: PDWORD;
dwBufferSize: LongWord;
begin
s_pd3dDevice := pd3dDevice;

dwBufferSize := StrLen(g_strBuffer) + 1;

Result:= D3DXCreateEffect(s_pd3dDevice, g_strBuffer, dwBufferSize, nil, nil, D3DXFX_NOT_CLONEABLE, nil, s_pEffect, nil); //<<< THIS CALL FAILED
if V_Failed(Result) then Exit;


Result:= DXUTCreateArrowMeshFromInternalArray(s_pd3dDevice, s_pMesh);
if V_Failed(Result) then Exit;

try
GetMem(rgdwAdjacency, SizeOf(DWORD)*s_pMesh.GetNumFaces*3);
except
Result:= E_OUTOFMEMORY;
Exit;
end;
V(s_pMesh.GenerateAdjacency(1e-6, rgdwAdjacency));
V(s_pMesh.OptimizeInplace(D3DXMESHOPT_VERTEXCACHE, rgdwAdjacency, nil, nil, nil));
FreeMem(rgdwAdjacency);

Result:= S_OK;
end;
[/pascal]

Because the callback failed, the DXUTCreate3DEnvironment failed too and then DXUTCleanup3DEnvironment is executed which contains the following:

[pascal]

// are unrelease objects.
GetDXUTState.D3DDevice:= nil;
if (pd3dDevice <nil> 0) then
begin
{$IFNDEF FPC} //todo: Remove this HACK after succesfull debugging of FPC port
DXUTDisplayErrorMessage(DXUTERR_NONZEROREFCOUNT);
DXUT_ERR('DXUTCleanup3DEnvironment', DXUTERR_NONZEROREFCOUNT);
{$IFDEF DEBUG}
// Forced clearing of D3DDevice references, so D3D debug level will show additional messages
OutputDebugString('DXUT.pas: releasing D3DDevice refcount until ZERO');
while (pd3dDevice._Release > 0) do;
{$ENDIF}
{$ENDIF}
end;
Pointer(pd3dDevice) := nil;
end;
[/pascal]

DXUTDisplayErrorMessage(DXUTERR_NONZEROREFCOUNT); shows the message.

The weird thing is that {$IFNDEF FPC} shouldn't return true because i'm using Delphi 7. :?
I see that when {$IFDEF DEBUG} returns true, all devices will be freed to make refcount zero.

Can you tell me why exactly the OnCreateDevice callback is failing, and what the sollution is??
Is the {$IFDEF DEBUG} thing a way to make sure that all devices are properly terminated??

Realy hope you can solve this!

EDIT: starting post fixed I initialy thought you would do that, because the thread was locked and i couldn't edit. i didn't have a look at it after you unlocked it. Thanx for reminding me.