Smalltalk code that uses the primitive above
The Smalltalk code that uses the primitive above is as follows:
The primitive declaration
installWindowProc: receiver selector: selector
"Private - Answer the address of the standard window proc.
Install the receiver and selector as the message that is
sent for every operating system message."
<primitive: installWindowProc>
^self primitiveFailed
Sample use of the primitive
initializeWindowClass
"Private - Get the standard VA Smalltalk window procedure and
register the window class in the operating system."
| address |
"Get the address of the window proc and install the receiver and
selector. This message is sent from the window proc for every
operating system message."
address := self
installWindowProc: self makeFixed
selector: #windowProc:msg:with:with: makeFixed.
"Register the Smalltalk window procedure."
WindowClass := 'WINDOWPROC'.
Hab
winRegisterClass: WindowClass
pfnWndProc: address
flStyle: CsSizeredraw
cbWindowData: 4.
The Smalltalk code places the receiver and selector in fixed memory so that they cannot move during garbage collection.
This code is based on the VA Smalltalk code for the window procedure. Some changes were made for clarity, so the code above might not match exactly the code in VA Smalltalk.
Last modified date: 01/29/2015