library Skin;uses
SysUtils,
Classes,
Dialogs,
controls,
Forms,
Windows,
Messages;var
OldWndProc: Pointer;function NewWndProc(hHwnd, Msg, wParam, lParam: LongWORD): Longint; stdcall;
begin
if Msg=WM_CLOSE then begin
ShowMessage('ok');
end;;
Result := CallWindowProc(OldWndProc, hHwnd, Msg, wParam, lParam);
end;function InitializeSkin(aControl: TControl): integer; stdcall;
begin TForm(aControl).Caption := 'Robert Lee'; OldWndProc := Pointer(GetWindowLong(TForm(aControl).Handle, GWL_WNDPROC));
setWindowLong(TForm(aControl).Handle, GWL_WNDPROC, Longint(@NewWndProc));
end;{$R *.RES}exports
InitializeSkin;beginend.在主程序中调用InitializeSkin传来一个一个Form,为什么执行到 setWindowLong(TForm(aControl).Handle, GWL_WNDPROC, Longint(@NewWndProc));
这一句就出错呢?
SysUtils,
Classes,
Dialogs,
controls,
Forms,
Windows,
Messages;var
OldWndProc: Pointer;function NewWndProc(hHwnd, Msg, wParam, lParam: LongWORD): Longint; stdcall;
begin
if Msg=WM_CLOSE then begin
ShowMessage('ok');
end;;
Result := CallWindowProc(OldWndProc, hHwnd, Msg, wParam, lParam);
end;function InitializeSkin(aControl: TControl): integer; stdcall;
begin TForm(aControl).Caption := 'Robert Lee'; OldWndProc := Pointer(GetWindowLong(TForm(aControl).Handle, GWL_WNDPROC));
setWindowLong(TForm(aControl).Handle, GWL_WNDPROC, Longint(@NewWndProc));
end;{$R *.RES}exports
InitializeSkin;beginend.在主程序中调用InitializeSkin传来一个一个Form,为什么执行到 setWindowLong(TForm(aControl).Handle, GWL_WNDPROC, Longint(@NewWndProc));
这一句就出错呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货