Cannot be converted to procedure getWindowlongptr lazarus / 21-General ---------------------------------------------------------------------- yazigegeda · 2024-05-09 17:03 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  type     { TForm2 }   TForm2 = class(TForm)    ListBox1: TListBox;    ListBox2: TListBox;    procedure FormCreate(Sender: TObject);  private    function MessageToString(const Message: TMessage): string;  public   Faddlist: TWndMethod;     listWndProc_Orig: TWndMethod;     procedure MyaddlistWndProc(var TheMessage: TLMessage);    procedure MylistWndProc(var TheMessage: TLMessage);    end;              Form2.listWndProc_Orig := TWndMethod(GetWindowLongPtr(listhwnd,GWL_WNDPROC));  MainUnit.pas(6452,27) Error: Illegal type conversion: "Int64" to "" Help me. What do I do?  :'( ---------------------------------------------------------------------- Red_prig · 2024-05-09 17:47 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 TWndMethod is a 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 of object and takes up 2 ptrint sizes and, accordingly, is not equal to the size of int64 ---------------------------------------------------------------------- cdbc · 2024-05-09 21:09 Hi Methinks 'GetWindowLongPtr' returns a WndProc /not/ WndMethod... So you could try this: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  type     { TForm2 }   TForm2 = class(TForm)    ListBox1: TListBox;    ListBox2: TListBox;    procedure FormCreate(Sender: TObject);  private    function MessageToString(const Message: TMessage): string;  public     Faddlist: TWndMethod;     listWndProc_Orig: TWndProc; // <<--- HERE!     procedure MyaddlistWndProc(var TheMessage: TLMessage);    procedure MylistWndProc(var TheMessage: TLMessage);    end;              Form2.listWndProc_Orig := TWndProc(GetWindowLongPtr(listhwnd,GWL_WNDPROC));// ...and in the typecast above ^ Otherwise you'll have to _generate_ a 'Method' from a procedural-pointer... Regards Benny ---------------------------------------------------------------------- jamie · 2024-05-09 21:18 You know you can "Override" the "WndProc" in the class without gaining access to the window procedure address that way, It should give you most of what you need. ---------------------------------------------------------------------- Thaddy · 2024-05-09 21:26 I gave him that already in the other thread. ---------------------------------------------------------------------- jamie · 2024-05-09 21:46 heres something I've made. comes with example. ---------------------------------------------------------------------- yazigegeda · 2024-05-10 03:55 Quote from: cdbc on May 09, 2024, 11:09:16 pmHi Methinks 'GetWindowLongPtr' returns a WndProc /not/ WndMethod... So you could try this: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  type     { TForm2 }   TForm2 = class(TForm)    ListBox1: TListBox;    ListBox2: TListBox;    procedure FormCreate(Sender: TObject);  private    function MessageToString(const Message: TMessage): string;  public     Faddlist: TWndMethod;     listWndProc_Orig: TWndProc; // <<--- HERE!     procedure MyaddlistWndProc(var TheMessage: TLMessage);    procedure MylistWndProc(var TheMessage: TLMessage);    end;              Form2.listWndProc_Orig := TWndProc(GetWindowLongPtr(listhwnd,GWL_WNDPROC));// ...and in the typecast above ^ Otherwise you'll have to _generate_ a 'Method' from a procedural-pointer... Regards Benny There is no TWndProc ---------------------------------------------------------------------- yazigegeda · 2024-05-10 04:42 Quote from: jamie on May 09, 2024, 11:18:30 pmYou know you can "Override" the "WndProc" in the class without gaining access to the window procedure address that way, It should give you most of what you need. Thank you for the code attachment, but I have to use GetWindowLong to get the WndProc of a control, because the control  .WindowProc property gets the parent control, and I want to get its child control, this parent control has two child controls, The first child control only has the class name Window, the second has the class name Window and the title List. I want to get the second child control with the title List 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  listhwnd := FindWindowEx(addresslist.Handle,0,'Window','List');Form2.listWndPro c_Orig :=  GetWindowLongPtr(listhwnd,GWL_WNDPROC); ---------------------------------------------------------------------- yazigegeda · 2024-05-10 05:11 Quote from: Thaddy on May 09, 2024, 11:26:52 pmI gave him that already in the other thread. I've looked at your other threads and it doesn't seem to be solved either, what should I do :'( ---------------------------------------------------------------------- Thaddy · 2024-05-10 11:25 Override wndproc. Problem solved. This has been told to you many times already and not only by me.... That has also the advantage that your code stays cross-platform. ---------------------------------------------------------------------- jamie · 2024-05-10 21:54 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 objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,LMessages; type   { TForm1 }TListBox = Class(StdCtrls.Tlistbox) Procedure WndProc(var Msg:TLMessage);Override; End;  TForm1 = class(TForm)    ListBox1: TListBox;  private   public   end; var  Form1: TForm1; implementation {$R *.lfm}Procedure TListBox.WndProc(Var msg:TLmessage); Begin    Inherited;    Form1.Caption := msg.msg.tostring; End;end.   Capture of the TlistBox message handler.