Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why not calling window procedure instead of calling CallWindowProc?

Why is there such function CallWindowProc? We are supplying the address of the window procedure, so isn't it better to call the function instead of calling another function which calls the function?

like image 496
Hayri Uğur Koltuk Avatar asked Jan 19 '23 13:01

Hayri Uğur Koltuk


2 Answers

Because GetWindowLong (or GetWindowLongPtr) might return a value that is not a function pointer, which CallWindowProc can recognise and translate into a proper call. [1]

like image 60
Cat Plus Plus Avatar answered Mar 29 '23 23:03

Cat Plus Plus


The CallWindowProc function handles Unicode-to-ANSI conversion. You cannot take advantage of this conversion if you call the window procedure directly.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms633571(v=vs.85).aspx

like image 32
Mike Avatar answered Mar 30 '23 01:03

Mike