procedure WMNCHitTest(var Msg:TWMNCHitTest);message WM_NCHITTEST;procedure TForm1{或你定义的Form名}.WMNCHitTest(var Msg:TWMNCHitTest); begin DefaultHandler(Msg); if Msg.Result =HTCAPTION then Msg.Result:= HTCLIENT; end;
用一下SDK的函数SetWindowPos把窗口设置为不能移动的 BOOL SetWindowPos( HWND hWnd, // handle to window HWND hWndInsertAfter, // placement-order handle int X, // horizontal position int Y, // vertical position int cx, // width int cy, // height UINT uFlags // window-positioning options ); uFlags 这个参数为 SWP_NOMOVE
begin
DefaultHandler(Msg);
if Msg.Result =HTCAPTION then
Msg.Result:= HTCLIENT;
end;
BOOL SetWindowPos(
HWND hWnd, // handle to window
HWND hWndInsertAfter, // placement-order handle
int X, // horizontal position
int Y, // vertical position
int cx, // width
int cy, // height
UINT uFlags // window-positioning options
);
uFlags 这个参数为 SWP_NOMOVE