Welcome, Guest
Username: Password: Remember me
Components and Libraries for Audio and Video Development, discussions, problems and suggestions
  • Page:
  • 1

TOPIC:

bug fix suggestion 9 years 3 months ago #7807

  • Alexander Gornostaev
  • Alexander Gornostaev's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 2
  • Thank you received: 0
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. :whistle:

Please Log in or Create an account to join the conversation.

bug fix suggestion 9 years 3 months ago #7808

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4535
  • Thank you received: 1114
Thanks Sir
please, attach here all modified files as one Zip or 7zip file
for test
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

  • Page:
  • 1