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
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Gtk3 widgetset - call for...
by
dbannon
[
Today
at 10:03:14 am]
Scripts to generate ofici...
by
dbannon
[
Today
at 09:57:06 am]
text color visible
by
creaothceann
[
Today
at 09:49:21 am]
Qt does not position form...
by
dbannon
[
Today
at 09:42:44 am]
Read/Parse PDB file to ge...
by
tooknox
[
Today
at 09:22:16 am]
Connecting to AzureSQL
by
Zvoni
[
Today
at 08:22:08 am]
Transparent form
by
Pe3s
[
Today
at 07:34:57 am]
When is it useful for a p...
by
Thaddy
[
Today
at 06:51:18 am]
Artificial Intelligence a...
by
Thaddy
[
Today
at 06:06:51 am]
FPC Unleashed (inline var...
by
Fibonacci
[
Today
at 06:06:41 am]
show me the parameters ce...
by
n7800
[May 13, 2026, 11:14:34 pm]
How to compare floating p...
by
Sander
[May 13, 2026, 11:12:02 pm]
TA Chart Axes visibility ...
by
Nicole
[May 13, 2026, 08:27:54 pm]
new feature for IDE
by
n7800
[May 13, 2026, 08:20:14 pm]
Can /my/ AI help me with ...
by
440bx
[May 13, 2026, 07:28:37 pm]
SynEdit auto End of line ...
by
eldonfsr
[May 13, 2026, 05:02:39 pm]
[beyond fixing]FPGMAP acc...
by
Thaddy
[May 13, 2026, 01:13:34 pm]
Hint tools gives wrong hi...
by
Nicole
[May 13, 2026, 01:11:47 pm]
[Solved] Scrollable, sing...
by
MathMan
[May 13, 2026, 01:00:08 pm]
Error: -macosx_version_mi...
by
Thaddy
[May 13, 2026, 11:59:25 am]
Stack overflow detection
by
Khrys
[May 13, 2026, 11:56:27 am]
Can I get the position an...
by
wp
[May 13, 2026, 11:26:26 am]
HTTP2 Support
by
valdir.marcos
[May 13, 2026, 10:10:34 am]
Lazarus and FreePascal on...
by
shayneoneill
[May 13, 2026, 05:51:48 am]
SYnEdit lose cursor
by
eldonfsr
[May 13, 2026, 03:31:46 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Window rendering error after calling CallWindowProc and DefWindowProc (Read 2955 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