Window rendering error after calling CallWindowProc and DefWindowProc lazarus / 67-Windows ---------------------------------------------------------------------- Pixelmak · 2021-12-21 10:10 I am trying to get Windows messages via WndCallback in Windows 11. But, after receiving the message, the window is not rendered normally. What am I doing wrong? (Screen in Attachment) 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 unit Unit1; {$mode delphi}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Windows; type   { TForm1 }   TForm1 = class(TForm)    Button1: TButton;    procedure Button1Click(Sender: TObject);    procedure FormCreate(Sender: TObject);  private   public   end;   function WndCallback(Ahwnd: HWND; uMsg: UINT; wParam: WParam; lParam: LParam): LRESULT; stdcall; var  Form1: TForm1;  PrevWndProc:windows.WNDPROC; implementation function WndCallback(Ahwnd: HWND; uMsg: UINT; wParam: WParam; lParam: LParam  ): LRESULT; stdcall;begin  result := CallWindowProc(PrevWndProc , Ahwnd, uMsg, WParam, LParam);end; {$R *.lfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject);begin  PrevWndProc := Windows.WNDPROC(SetWindowLongPtr(Self.Handle, GWL_WNDPROC, PtrUInt(@WndCallback)));end; procedure TForm1.Button1Click(Sender: TObject);begin  writeln('Button clicked');end; end. ---------------------------------------------------------------------- Pixelmak · 2021-12-21 10:14 Oh, I'm sorry. This code works now. I don’t know for what reason this error occurred. Perhaps the reason was that I used DefWindowProc instead of CallWindowProc