there are some VCL specific function calls which relay on windows Handle mechanism in implementation of ASIO interface wraper. i've fixed this for my version of this library any way i would like to publish changes ive made but offcause i've no access to you lib repository. (It seeems quite diffferent with those wich is availible on Sourceforge with a lot of bonus stuff and fpc features) so i pulish the changes here.
in ASIO interface is used function AllocateHWnd/deAllocateHWnd from Borland/Embarcadero rtl for delphi. how ever becouse thise geting /throuaway handels is tooo windows (or othe couses i dont know) these to functions were never implemented in fpc. The only think they do they throw runtime error if someone is trying to call them at the run time. so here is my work around
in dav_asiocore unit new function:
function dav_getHndl(wndFnc:TWndMethod): HWND;
var
UtilWindowClass:TWndClass;
TempClass: TWndClass;
ClassRegistered: Boolean;
begin
Result:=0;
FillChar(UtilWindowClass,sizeOf(TWndClass),0);
UtilWindowClass.lpfnWndProc := @wndFnc;
UtilWindowClass.hInstance := HInstance;
UtilWindowClass.lpszClassName := 'TPUtilWindow' ;
ClassRegistered := GetClassInfo(HInstance, UtilWindowClass.lpszClassName,
TempClass);
if not ClassRegistered or (@TempClass.lpfnWndProc <> @wndFnc) then
begin
if ClassRegistered then
Windows.UnregisterClass(UtilWindowClass.lpszClassName, HInstance);
Windows.RegisterClass(UtilWindowClass);
end;
Result := CreateWindowEx(WS_EX_TOOLWINDOW, UtilWindowClass.lpszClassName,
'', WS_POPUP {+ 0}, 0, 0, 0, 0, 0, 0, HInstance, nil);
SetWindowLongPtr(Result, GWL_WNDPROC, IntPtr(MakeObjectInstance(wndFnc)));
end;
okay we make fake window to be able handle system mesages. like it is maked in ASIO Wraper
the usage is:
in constructor of TCustomAsioHostBasic classes in unit DAV_AsioHostCore
in constructor TAsioHostCore classes in unit DAV_AsioHostCore
and TCustomASIOHostBasic in unit DAV_AsioHostCoreX
i think that using simple DestroyWindow(FHandle) instead of DeallocateHWnd is safe anough in this case.