mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:42:59 +00:00
[SDK:ATL] Implement GetDlgItemText(BSTR&), GetTopLevelParent(), GetWindowText(CSimpleString&). (#4207)
And add SAL annotations to the Get***Text family of functions.
This commit is contained in:
parent
e60a4f00b5
commit
14dbd66d88
1 changed files with 45 additions and 14 deletions
|
@ -568,39 +568,51 @@ public:
|
||||||
return E_FAIL;//FIXME stub
|
return E_FAIL;//FIXME stub
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND GetDlgItem(int nID)
|
HWND GetDlgItem(_In_ int nID) const
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsWindow(m_hWnd));
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
return ::GetDlgItem(m_hWnd, nID);
|
return ::GetDlgItem(m_hWnd, nID);
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT GetDlgItemInt(int nID, BOOL* lpTrans = NULL, BOOL bSigned = TRUE) const
|
UINT GetDlgItemInt(
|
||||||
|
_In_ int nID,
|
||||||
|
_Out_opt_ BOOL* lpTrans = NULL,
|
||||||
|
_In_ BOOL bSigned = TRUE) const
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsWindow(m_hWnd));
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
return ::GetDlgItemInt(m_hWnd, nID, lpTrans, bSigned);
|
return ::GetDlgItemInt(m_hWnd, nID, lpTrans, bSigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT GetDlgItemText(int nID, LPTSTR lpStr, int nMaxCount) const
|
UINT GetDlgItemText(
|
||||||
|
_In_ int nID,
|
||||||
|
_Out_writes_to_(nMaxCount, return + 1) LPTSTR lpStr,
|
||||||
|
_In_ int nMaxCount) const
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsWindow(m_hWnd));
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
return ::GetDlgItemText(m_hWnd, nID, lpStr, nMaxCount);
|
return ::GetDlgItemText(m_hWnd, nID, lpStr, nMaxCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __ATLSTR_H__
|
#ifdef __ATLSTR_H__
|
||||||
UINT GetDlgItemText(int nID, CSimpleString& string)
|
UINT GetDlgItemText(_In_ int nID, _Inout_ CSimpleString& strText) const
|
||||||
{
|
{
|
||||||
HWND item = GetDlgItem(nID);
|
HWND item = GetDlgItem(nID);
|
||||||
int len = ::GetWindowTextLength(item);
|
if (!item)
|
||||||
len = GetDlgItemText(nID, string.GetBuffer(len+1), len+1);
|
{
|
||||||
string.ReleaseBuffer(len);
|
strText.Empty();
|
||||||
return len;
|
return 0;
|
||||||
|
}
|
||||||
|
return CWindow(item).GetWindowText(strText);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BOOL GetDlgItemText(int nID, BSTR& bstrText) const
|
BOOL GetDlgItemText(
|
||||||
|
_In_ int nID,
|
||||||
|
_Inout_ _Outref_result_maybenull_ _Post_z_ BSTR& bstrText) const
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsWindow(m_hWnd));
|
HWND item = GetDlgItem(nID);
|
||||||
return FALSE;//FIXME stub
|
if (!item)
|
||||||
|
return FALSE;
|
||||||
|
return CWindow(item).GetWindowText(bstrText);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD GetExStyle() const
|
DWORD GetExStyle() const
|
||||||
|
@ -690,7 +702,13 @@ public:
|
||||||
HWND GetTopLevelParent() const
|
HWND GetTopLevelParent() const
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsWindow(m_hWnd));
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
return NULL;//FIXME stub
|
|
||||||
|
HWND hWndParent = m_hWnd;
|
||||||
|
HWND hWndTmp;
|
||||||
|
while ((hWndTmp = ::GetParent(hWndParent)) != NULL)
|
||||||
|
hWndParent = hWndTmp;
|
||||||
|
|
||||||
|
return hWndParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND GetTopLevelWindow() const
|
HWND GetTopLevelWindow() const
|
||||||
|
@ -773,13 +791,26 @@ public:
|
||||||
return ::GetWindowRgn(m_hWnd, hRgn);
|
return ::GetWindowRgn(m_hWnd, hRgn);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetWindowText(LPTSTR lpszStringBuf, int nMaxCount) const
|
int GetWindowText(
|
||||||
|
_Out_writes_to_(nMaxCount, return + 1) LPTSTR lpszStringBuf,
|
||||||
|
_In_ int nMaxCount) const
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsWindow(m_hWnd));
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
return ::GetWindowText(m_hWnd, lpszStringBuf, nMaxCount);
|
return ::GetWindowText(m_hWnd, lpszStringBuf, nMaxCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL GetWindowText(BSTR& bstrText)
|
#ifdef __ATLSTR_H__
|
||||||
|
int GetWindowText(_Inout_ CSimpleString& strText) const
|
||||||
|
{
|
||||||
|
int len = GetWindowTextLength();
|
||||||
|
len = GetWindowText(strText.GetBuffer(len + 1), len + 1);
|
||||||
|
strText.ReleaseBuffer(len);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BOOL GetWindowText(
|
||||||
|
_Inout_ _Outref_result_maybenull_ _Post_z_ BSTR& bstrText) const
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsWindow(m_hWnd));
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
INT length = ::GetWindowTextLengthW(m_hWnd);
|
INT length = ::GetWindowTextLengthW(m_hWnd);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue