× Components and Libraries for Audio and Video Development, discussions, problems and suggestions

Question bug fix suggestion

  • Alexander Gornostaev
  • Topic Author
  • Offline
  • New Member
  • New Member
6 years 2 months ago #7807 by Alexander Gornostaev
bug fix suggestion was created by Alexander Gornostaev
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;
  TempClass: TWndClass;
  ClassRegistered: Boolean;
  UtilWindowClass.lpfnWndProc := @wndFnc;
  UtilWindowClass.hInstance := HInstance;
  UtilWindowClass.lpszClassName := 'TPUtilWindow' ;
  ClassRegistered := GetClassInfo(HInstance, UtilWindowClass.lpszClassName,
  if not ClassRegistered or (@TempClass.lpfnWndProc <> @wndFnc) then
    if ClassRegistered then
     Windows.UnregisterClass(UtilWindowClass.lpszClassName, HInstance);
  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)));
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.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Away
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
6 years 2 months ago #7808 by Sternas Stefanos
Replied by Sternas Stefanos on topic bug fix suggestion
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.