有关WM_WINDOWPOSCHANGING消息的问题

chw_csdn_chw 2003-10-09 05:34:17
我在研究WM_WINDOWPOSCHANGING消息时在delphi 6.0 的帮助中找到这样一段注解:
The WM_WINDOWPOSCHANGING message is sent to a window whose size, position, or place in the Z order is about to change as a result of a call to the SetWindowPos function or another window-management function.

WM_WINDOWPOSCHANGING
lpwp = (LPWINDOWPOS) lParam; // points to size and position data

Parameters

lpwp
Value of lParam. Points to a WINDOWPOS structure that contains information about the window's new size and position.

请问,LPWINDOWPOS类型在哪个单元中定义的
要在程序中使用LPWINDOWPOS,需要use 哪个单元?
...全文
493 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hatedeadlock 2003-10-12
  • 打赏
  • 举报
回复
LPWINDOWPOS Points to a WINDOWPOS structure
var w:windowpos
@w就是你要的参数了吗
pankun 2003-10-12
  • 打赏
  • 举报
回复
你先定义一个WindowPos类型的变量(声明于Windows单元).
例如
WinPos: WindowPos;
再用@WindowPos作LParam参数就可以了.
FrameSniper 2003-10-12
  • 打赏
  • 举报
回复
楼上的朋友的答复不知道要说明什么?

应该是在Windows单元中有相关说明,如果你需要使用这个消息的参数,可以直接使用LParams,而不是这个具体的结构!
hatedeadlock 2003-10-12
  • 打赏
  • 举报
回复
LPWINDOWPOS Points to a WINDOWPOS structure

The WINDOWPOS structure contains information about the size and position of a window.

typedef struct _WINDOWPOS { // wp
HWND hwnd;
HWND hwndInsertAfter;
int x;
int y;
int cx;
int cy;
UINT flags;
} WINDOWPOS;


Members

hwnd

Identifies the window.

hwndInsertAfter

Specifies the position of the window in Z order (front-to-back position). This member can be the handle of the window behind which this window is placed, or can be one of the special values listed with the SetWindowPos function.

x

Specifies the position of the left edge of the window.

y

Specifies the position of the top edge of the window.

cx

Specifies the window width, in pixels.

cy

Specifies the window height, in pixels.

flags

Specifies the window position. This member can be one of the following values:

Value Meaning
SWP_DRAWFRAME Draws a frame (defined in the window's class description) around the window.
SWP_FRAMECHANGED Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window's size is being changed.
SWP_HIDEWINDOW Hides the window.
SWP_NOACTIVATE Does not activate the window. If this flag is not set, the window is activated and moved to the top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter).
SWP_NOCOPYBITS Discards the entire contents of the client area. If this flag is not specified, the valid contents of the client area are saved and copied back into the client area after the window is sized or repositioned.
SWP_NOMOVE Retains the current position (ignores the X and Y parameters).
SWP_NOOWNERZORDER Does not change the owner window's position in the Z order.
SWP_NOREDRAW Does not redraw changes. If this flag is set, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of the window being moved. When this flag is set, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.
SWP_NOREPOSITION Same as the SWP_NOOWNERZORDER flag.
SWP_NOSENDCHANGING Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
SWP_NOSIZE Retains the current size (ignores the cx and cy parameters).
SWP_NOZORDER Retains the current Z order (ignores the hWndInsertAfter parameter).
SWP_SHOWWINDOW Displays the window.
消息,就是指Windows发出的一个通知,告诉应用程序某个事情发生了。例如,单击鼠标、改变窗口尺寸、按下键盘上的一个键都会使Windows发送一个消息给应用程序。 消息本身是作为一个记录传递给应用程序的,这个记录中包含了消息的类型以及其他信息。例如,对于单击鼠标所产生的消息来说,这个记录中包含了单击鼠标时的坐标。这个记录类型叫做TMsg,它在Windows单元中是这样声明的: type TMsg = packed record hwnd: HWND; //窗口句柄 message: UINT;//消息常量标识符 wParam: WPARAM ;// 32位消息的特定附加信息 lParam: LPARAM ;// 32位消息的特定附加信息 time: DWORD;//消息创建时的时间 pt: TPoint; //消息创建时的鼠标位置 end ; 消息中有什么? 是否觉得一个消息记录中的信息像希腊语一样?如果是这样,那么看一看下面的解释:hwnd 32位的窗口句柄。窗口可以是任何类型的屏幕对象,因为Win32能够维护大多数可 视对象的句柄(窗口、对话框、按钮、编辑框等)。message 用于区别其他消息的常量值,这些常量可以是Windows单元中预定义的常量,也 可以是自定义的常量。 wParam 通常是一个与消息有关的常量值,也可能是窗口或控件的句柄。 lParam 通常是一个指向内存中数据的指针。由于WParam、lParam和Pointer都是32位的,因此,它们之间可以相互转换。 WM_NULL =$0000 // WM_CREATE =$0001 //应用程序创建一个窗口 WM_DESTROY = $0002 //一个窗口被销毁 WM_MOVE = $0003 //移动一个窗口 WM_SIZE= $0005 //改变一个窗口的大小 WM_ACTIVATE= $0006 //一个窗口被激活或失去激活状态; WM_SETFOCUS= $0007 //获得焦点后 WM_KILLFOCUS= $0008 //失去焦点 WM_ENABLE= $000A //改变enable状态 WM_SETREDRAW= $000B //设置窗口是否能重画 WM_SETTEXT= $000C //应用程序发送此消息来设置一个窗口的文本 WM_GETTEXT = $000D //应用程序发送此消息来复制对应窗口的文本到缓冲区 WM_GETTEXTLENGTH = $000E //得到与一个窗口有关的文本的长度(不包含空字符) WM_PAINT = $000F //要求一个窗口重画自己 WM_CLOSE = $0010 //当一个窗口或应用程序要关闭时发送一个信号 WM_QUERYENDSESSION= $0011 //当用户选择结束对话框或程序自己调用ExitWindows函数 WM_QUIT= $0012 //用来结束程序运行或当程序调用postquitmessage函数 WM_QUERYOPEN = $0013 //当用户窗口恢复以前的大小位置时,把此消息发送给某个图标 WM_ERASEBKGND = $0014 //当窗口背景必须被擦除时(例在窗口改变大小时) WM_SYSCOLORCHANGE = $0015 //当系统颜色改变时,发送此消息给所有顶级窗口 WM_ENDSESSION = $0016 // 当系统进程发出WM_QUERYENDSESSION消息后,此消息发送给应用程序,通知它对话是否结束 WM_SYSTEMERROR = $0017 // WM_SHOWWINDOW= $0018 //当隐藏或显示窗口是发送此消息给这个窗口 WM_ACTIVATEAPP = $001C //发此消息给应用程序哪个窗口是激活的,哪个是非激活的; WM_FONTCHANGE= $001D //当系统的字体资源库变化时发送此消息给所有顶级窗口 WM_TIMECHANGE= $001E //当系统的时间变化时发送此消息给所有顶级窗口 WM_CANCELMODE= $001F //发送此消息来取消某种正在进行的摸态(操作) WM_SETCURSOR = $0020 //如果鼠标引起光标在某个窗口中移动且鼠标输入没有被捕获时,就发消息给某个窗口 WM_MOUSEACTIVATE = $0021 //当光标在某个非激活的窗口中而用户正按着鼠标的某个键发送此消息给当前窗口 WM_CHILDACTIVATE = $0022 //发送此消息给MDI子窗口当用户点击此窗口的标题栏,或当窗口被激活,移动,改变大小 WM_QUEUESYNC= $0023 //此消息由基

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧