Access violation error lazarus / 61-Beginners ---------------------------------------------------------------------- facido · 2018-07-09 10:58 I am receiving "Access violation" error message at line 15 on the following codes: 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 main.GoToURLClick(Sender: TObject);Var Browser:TEvsWebBrowser;      Doc: IHTMLDocument2;      WebForm: IHTMLFormElement;      FormElements: OleVariant;      _data: variant;      url,onull:Olevariant;      ActiveXContainer:TActiveXContainer;      ovElements: OleVariant;begin       Browser:=TEvsWebBrowser.Create(Self);       ActiveXContainer.ComServer:=Browser.ComServer;      ActiveXContainer.Active:=true;   // "Access violation" error occurs here       ................   What could be the reason for the error? ---------------------------------------------------------------------- taazz · 2018-07-09 11:02 activexContainer is never created. ---------------------------------------------------------------------- facido · 2018-07-09 14:50 How can you create the activexContainer? The following code gives me runtime error: 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 ActivexContainer.Create(Self);  I am a beginner in Lazarus programming. ---------------------------------------------------------------------- munair · 2018-07-09 15:32 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 ActiveXContainer := TActiveXContainer.Create;You should also know why the error did not occur on line 14, even though the object wasn't created. ---------------------------------------------------------------------- facido · 2018-07-10 03:47 Does anyone know why the same error didn't occur at line 14? ---------------------------------------------------------------------- ASerge · 2018-07-10 04:50 Quote from: facido on July 10, 2018, 05:47:41 amDoes anyone know why the same error didn't occur at line 14? ActiveXContainer without Create point to random memory. Line 14 copies a single pointer value to this random location. You're lucky you didn't lose something important because the random area is small. Using Active := true; already requires a fully valid Self, because property Active call "write" method. Here luck has already turned away because there is too little chance that a random memory area will match the correct object.