[solved] About Embedding a webserver tutorial lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- CapelliC · 2020-07-29 16:57 Was trying to apply this tutorial https://www.freepascal.org/~michael/articles/webserver1/webserver1.pdf to a simple application form. Seems the TThread Synchronize signature method doesn't match, indeed a first parameter, of type TThread, is required, from the GUI handler Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TMainForm.DoHandleRequest(Sender: TObject;  var ARequest: TFPHTTPConnectionRequest;  var AResponse: TFPHTTPConnectionResponse);begin  FURL:=Arequest.URL;  FServer.Synchronize(@ShowURL); // error here  FHandler.HandleRequest(ARequest,AResponse); // I will replace FHandler with mineend;  What is the GUI TThread handler ? ---------------------------------------------------------------------- PascalDragon · 2020-07-30 07:51 You need to use Nil here. It's about the current thread, not the target thread, and the event handler will be called in the context of the server thread. Did you put the server thread class into a separate unit to the form or in the same unit? If the former then this might explain why it worked for the author MvC, because the visibility rules allow you to access protected members of a parent class declared in a different unit (in this case the protected Synchronize with one parameter declared in Classes.TThread). ---------------------------------------------------------------------- CapelliC · 2020-07-30 09:26 Thanks, it worked. Guess you meant 'members of a parent class declared in the same unit' instead of Quote from: PascalDragon on July 30, 2020, 09:51:34 ammembers of a parent class declared in a different unit. Now trying to gracefully stop the HTTP server. Terminate doesn't have effect... ---------------------------------------------------------------------- PascalDragon · 2020-07-30 09:57 Quote from: CapelliC on July 30, 2020, 11:26:32 amGuess you meant 'members of a parent class declared in the same unit' instead of Quote from: PascalDragon on July 30, 2020, 09:51:34 ammembers of a parent class declared in a different unit No, I meant it as I wrote it. If you have a class A in unit X that inherits from a class B in unit Y then any code in unit X (even outside class A) can access protected members of class B. ---------------------------------------------------------------------- CapelliC · 2020-07-30 10:02 Ok, thanks for the explanation. I'm such a noob at FPC... ---------------------------------------------------------------------- PascalDragon · 2020-07-30 11:18 Don't feel bad about this. I had to think a bit about this as well, as I usually don't encounter this.