⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 windowtext.h

📁 hl2 source code. Do not use it illegal.
💻 H
字号:
/*----------------------------------------------------------------------
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -