GetDlgItem的问题
HWNDGetDlgItem(HWNDhDlg,intnIDDlgItem);请问这两个参数都表示什么意思,应该怎样得到??...
HWND GetDlgItem(
HWND hDlg,
int nIDDlgItem
);
请问这两个参数都表示什么意思,应该怎样得到?? 展开
HWND hDlg,
int nIDDlgItem
);
请问这两个参数都表示什么意思,应该怎样得到?? 展开
3个回答
展开全部
hWnd是父窗口的句柄,一般用m_hWnd就可以了
第二个参数是控件的ID号。
第二个参数是控件的ID号。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不好意思,转自MSDN:
GetDlgItem
The GetDlgItem function retrieves the handle of a control in the specified dialog box.
HWND GetDlgItem(
HWND hDlg, // handle of dialog box
int nIDDlgItem // identifier of control
);
Parameters
hDlg
Identifies the dialog box that contains the control.
nIDDlgItem
Specifies the identifier of the control to be retrieved.
Return Values
If the function succeeds, the return value is the window handle of the given control.
If the function fails, the return value is NULL, indicating an invalid dialog box handle or a nonexistent control. To get extended error information, callGetLastError.
Remarks
You can use the GetDlgItem function with any parent-child window pair, not just with dialog boxes. As long as the hDlg parameter specifies a parent window and the child window has a unique identifier (as specified by the hMenu parameter in the CreateWindow or CreateWindowEx function that created the child window), GetDlgItem returns a valid handle to the child window.
Windows CE: The GetDlgItem function only works for immediate child controls of a dialog box—it will not search through nested dialog boxes.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winuser.h.
Import Library: Use user32.lib.
GetDlgItem
The GetDlgItem function retrieves the handle of a control in the specified dialog box.
HWND GetDlgItem(
HWND hDlg, // handle of dialog box
int nIDDlgItem // identifier of control
);
Parameters
hDlg
Identifies the dialog box that contains the control.
nIDDlgItem
Specifies the identifier of the control to be retrieved.
Return Values
If the function succeeds, the return value is the window handle of the given control.
If the function fails, the return value is NULL, indicating an invalid dialog box handle or a nonexistent control. To get extended error information, callGetLastError.
Remarks
You can use the GetDlgItem function with any parent-child window pair, not just with dialog boxes. As long as the hDlg parameter specifies a parent window and the child window has a unique identifier (as specified by the hMenu parameter in the CreateWindow or CreateWindowEx function that created the child window), GetDlgItem returns a valid handle to the child window.
Windows CE: The GetDlgItem function only works for immediate child controls of a dialog box—it will not search through nested dialog boxes.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winuser.h.
Import Library: Use user32.lib.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询