Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Free Pascal
»
Windows
(Moderators:
FPK
,
Tomas Hajny
) »
Window rendering error after calling CallWindowProc and DefWindowProc
Free Pascal
Website
Downloads
Wiki
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
How can one optimise inse...
by
y.ivanov
[
Today
at 01:13:27 am]
Advanced Records Initiali...
by
ASerge
[
Today
at 12:42:49 am]
Free Pascal Standards
by
marcov
[
Today
at 12:40:01 am]
Parsing Long string to sp...
by
JLWest
[August 13, 2022, 11:34:57 pm]
My confession - I am a Pa...
by
Ten_Mile_Hike
[August 13, 2022, 11:24:35 pm]
Forest and lumber jack to...
by
JuhaManninen
[August 13, 2022, 11:09:23 pm]
How to Add a MenuItem to ...
by
HeavyUser
[August 13, 2022, 09:28:25 pm]
[SOLVED] Bottom sliding ...
by
Pe3s
[August 13, 2022, 09:28:12 pm]
problem install lamw4 lin...
by
microb
[August 13, 2022, 09:22:16 pm]
Using the Mouse Wheel to ...
by
J-G
[August 13, 2022, 09:02:19 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Window rendering error after calling CallWindowProc and DefWindowProc (Read 1879 times)
Pixelmak
New member
Posts: 7
Window rendering error after calling CallWindowProc and DefWindowProc
«
on:
December 21, 2021, 11:10:47 am »
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]
[+]
[-]
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
.
Logged
Pixelmak
New member
Posts: 7
Re: Window rendering error after calling CallWindowProc and DefWindowProc
«
Reply #1 on:
December 21, 2021, 11:14:27 am »
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
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Free Pascal
»
Windows
(Moderators:
FPK
,
Tomas Hajny
) »
Window rendering error after calling CallWindowProc and DefWindowProc
TinyPortal
© 2005-2018