Office中国论坛/Access中国论坛

标题: 请教!如何获取当前窗口在屏幕上位置的参数 [打印本页]

作者: sxgaobo    时间: 2003-4-29 23:58
标题: 请教!如何获取当前窗口在屏幕上位置的参数
及窗口左上角在屏幕上的位置
作者: zhengjialon    时间: 2003-4-30 00:15
查一下API。ACCESS不提供类似内置功能,这样的只能通过API获取。
作者: sxgaobo    时间: 2003-4-30 02:47
可以用:DoCmd.MoveSize 1134, 1134 指定被打开窗体的位置,我想也可以找到已打开窗体的位置参数吧!
烦请高手赐教!!!
作者: Roadbeg    时间: 2003-4-30 06:08
使用如下 api 获得指定窗口的位置,
请注意,你必须声明 rect,postionapi,windowplacement 三个结构.
Private Declare Function GetWindowPlacement Lib "user32" Alias "GetWindowPlacement" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long
作者: sxgaobo    时间: 2003-4-30 19:43
标题: Roadbeg 谢谢您的回答
[attach]298[/attach]
可我还是不太懂,你能给具体做一下吗?非常感谢,拜托了!!!
作者: Roadbeg    时间: 2003-4-30 23:42
GetWindowPlacement
The GetWindowPlacement function retrieves the show state and the restored, minimized, and maximized positions of the specified window.

BOOL GetWindowPlacement(
  HWND hWnd,               // handle to window
  WINDOWPLACEMENT *lpwndpl // address of structure for position data
);

Parameters
hWnd
Handle to the window.
lpwndpl
Pointer to the WINDOWPLACEMENT structure that receives the show state and position information.
Before calling GetWindowPlacement, set the length member of the WINDOWPLACEMENT structure to sizeof(WINDOWPLACEMENT). GetWindowPlacement fails if lpwndpl->length is not set correctly.

Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, callGetLastError.

Remarks
The flags member of WINDOWPLACEMENT retrieved by this function is always zero. If the window identified by the hWnd parameter is maximized, the showCmd member is SW_SHOWMAXIMIZED. If the window is minimized, showCmd is SW_SHOWMINIMIZED. Otherwise, it is SW_SHOWNORMAL.

The length member of WINDOWPLACEMENT must be set to sizeof(WINDOWPLACEMENT). If this member is not set correctly, the function returns FALSE. For additional remarks on the proper use of window placement coordinates, see WINDOWPLACEMENT.

QuickInfo
  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in winuser.h.
  Import Library: Use user32.lib.

See Also
Windows Overview, Window Functions, SetWindowPlacement, WINDOWPLACEMENT

作者: Roadbeg    时间: 2003-5-1 01:24
[attach]300[/attach]
作者: sxgaobo    时间: 2003-5-1 02:28
非常感谢Roadbeg !!!
正是吾所需,谢谢!



作者: apsfxc1    时间: 2008-8-13 09:40
学习[:30]




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3