salvadordf / WebUI4Delphi

WebUI4Delphi is a WebUI wrapper, which allows you to use any web browser as a GUI, with Delphi or Lazarus/FPC in the backend and HTML5 in the frontend.
https://www.briskbard.com/forum/
MIT License
107 stars 15 forks source link

Hello, could you please modify the return value of TWebUIFileHandlerCallback to support resources other than strings! #2

Closed heimo88 closed 5 months ago

heimo88 commented 5 months ago

Hello, could you please modify the return value of TWebUIFileHandlerCallback to support resources other than strings? You can change the return value to Pointer, so it can support images, videos, or other types of files.

//in uWebUITypes TWebUIFileHandlerCallback = function(const filename: PWebUIChar; len: PInteger): PWebUIChar; cdecl; //change to : TWebUIFileHandlerCallback = function(const filename: PWebUIChar; len: PInteger): Pointer; cdecl; Then I can use in SetFileHandler like this: ResStream := TResourceStream.Create(HInstance, pansichar(tmpstr), RT_RCDATA); len^ := ResStream.Size; LRsltBuffer := webui_malloc(len^); ResStream.ReadBuffer(LRsltBuffer^, len^); Result := LRsltBuffer; I have tested, it worked fine!

salvadordf commented 5 months ago

Thanks for reporting this issue!

The last update includes the correct TWebUIFileHandlerCallback return type.