windowtext.h
来自「hl2 source code. Do not use it illegal.」· C头文件 代码 · 共 45 行
H
45 行
/*----------------------------------------------------------------------
Copyright (c) 1998,1999 Gipsysoft. All Rights Reserved.
Please see the file "licence.txt" for licencing details.
File: WindowText.h
Owner: russf@gipsysoft.com
Purpose: Simple class to handle getting the window text into a string
----------------------------------------------------------------------*/
#ifndef WINDOWTEXT_H
#define WINDOWTEXT_H
class CWindowText
{
public:
inline explicit CWindowText( HWND hwnd );
inline ~CWindowText() { if( m_pszText ) delete[] m_pszText; }
inline operator LPTSTR() const { return m_pszText; }
inline int GetLength() const { return m_nLength; }
private:
CWindowText(); // Not implemented
CWindowText( const CWindowText &rhs );
CWindowText& operator =( const CWindowText &rhs );
LPTSTR m_pszText;
int m_nLength;
};
inline CWindowText::CWindowText( HWND hwnd )
: m_pszText( NULL )
{
ASSERT_VALID_HWND( hwnd );
m_nLength = GetWindowTextLength( hwnd );
if( m_nLength )
{
m_pszText = new TCHAR[ m_nLength + 1];
if( m_pszText )
{
VAPI( GetWindowText( hwnd, m_pszText, m_nLength + 1 ) );
}
}
}
#endif //WINDOWTEXT_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?