www.pudn.com > VC写的MP3播放器源代码.zip > ITAPI3.cpp


///////////////////////////////////////////////////////////////////////////// 
 
///////////////////////////////////////////////////////////////////////////// 
// 
// $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  
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  
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  
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  
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  
BOOL ITCLIB::IsStaticControl(HWND hWndCtl) 
{ 
	return CompareClassName(hWndCtl, _szStatic); 
}