scwndprc.pas
来自「《Delphi开发人员指南》配书原码」· PAS 代码 · 共 34 行
PAS
34 行
unit Scwndprc;
interface
uses Forms, Messages;
const
DDGM_FOOMSG = WM_USER;
implementation
uses Windows, SysUtils, Dialogs;
var
WProc: Pointer;
function NewWndProc(Handle: hWnd; Msg, wParam, lParam: Longint): Longint;
stdcall;
{ This is a Win32 API-level window procedure. It handles the messages }
{ received by the Application window. }
begin
if Msg = DDGM_FOOMSG then
{ If it's our user-defined message, then alert the user. }
ShowMessage(Format('Message seen by WndProc! Value is: $%x', [Msg]));
{ Pass message on to old window procedure }
Result := CallWindowProc(WProc, Handle, Msg, wParam, lParam);
end;
initialization
{ Set window procedure of Application window. }
WProc := Pointer(SetWindowLong(Application.Handle, gwl_WndProc,
Integer(@NewWndProc)));
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?