itapi3.cpp

来自「完整的MP3播放器源码」· C++ 代码 · 共 124 行

CPP
124
字号
/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
//
// $NoKeywords: $
//
// @doc EXTERNAL API

#include "StdAfx.h"

#include "ITAPI.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////

static const TCHAR _szEdit[]      = _T("Edit");
static const TCHAR _szButton[]    = _T("Button");
static const TCHAR _szComboBox[]  = _T("ComboBox");
static const TCHAR _szListBox[]   = _T("ListBox");
static const TCHAR _szStatic[]    = _T("Static");

/////////////////////////////////////////////////////////////////////////////

// @func This function compares the window class name with the specified
// string.
//
// @parm The window handle of the window.
// @parm A string to compare the window class name to.
//
// @rdesc Nonzero if the class name matches the specified string; otherwise 0.
BOOL ITCLIB::CompareClassName(HWND hWndCtl, LPCTSTR lpszClassName)
{
	ASSERT(::IsWindow(hWndCtl));

	TCHAR szClassName[64];
//	if (::GetClassName(hWndCtl, szClassName, CountOf(szClassName)) == 0)
//		return FALSE;

	return (_tcscmp(szClassName, lpszClassName) == 0);
}

/////////////////////////////////////////////////////////////////////////////
// Control types

// @func This function determines if the specified window is an EDIT
// control based on its window class name.
//
// @parm The window handle of the window.
//
// @rdesc Nonzero if the specified window is an EDIT control; otherwise 0.
//
// @comm This function is in the ITCLIB namespace.
//
// @xref <t CompareClassName>
BOOL ITCLIB::IsEditControl(HWND hWndCtl)
{
	return CompareClassName(hWndCtl, _szEdit);
}

// @func This function determines if the specified window is a BUTTON
// control based on its window class name.
//
// @parm The window handle of the window.
//
// @rdesc Nonzero if the specified window is a BUTTON control; otherwise 0.
//
// @comm This function is in the ITCLIB namespace.
//
// @xref <t CompareClassName>
BOOL ITCLIB::IsButtonControl(HWND hWndCtl)
{
	return CompareClassName(hWndCtl, _szButton);
}

// @func This function determines if the specified window is a COMBOBOX
// control based on its window class name.
//
// @parm The window handle of the window.
//
// @rdesc Nonzero if the specified window is a COMBOBOX control; otherwise 0.
//
// @comm This function is in the ITCLIB namespace.
//
// @xref <t CompareClassName>
BOOL ITCLIB::IsComboBoxControl(HWND hWndCtl)
{
	return CompareClassName(hWndCtl, _szComboBox);
}

// @func This function determines if the specified window is a LISTBOX
// control based on its window class name.
//
// @parm The window handle of the window.
//
// @rdesc Nonzero if the specified window is a LISTBOX control; otherwise 0.
//
// @comm This function is in the ITCLIB namespace.
//
// @xref <t CompareClassName>
BOOL ITCLIB::IsListBoxControl(HWND hWndCtl)
{
	return CompareClassName(hWndCtl, _szListBox);
}

// @func This function determines if the specified window is a STATIC
// control based on its window class name.
//
// @parm The window handle of the window.
//
// @rdesc Nonzero if the specified window is a STATIC control; otherwise 0.
//
// @comm This function is in the ITCLIB namespace.
//
// @xref <t CompareClassName>
BOOL ITCLIB::IsStaticControl(HWND hWndCtl)
{
	return CompareClassName(hWndCtl, _szStatic);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?