home *** CD-ROM | disk | FTP | other *** search
/ PC Administrator / spravce.iso / RunModule / src / MyComboBox.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-11  |  4.0 KB  |  107 lines

  1. // MyComboBox.cpp: implementation of the CMyComboBox class.
  2. //
  3. /*
  4. Copyright 2001 Anish Mistry. All rights reserved.
  5.  
  6. Redistribution and use in source and binary forms, with or without modification,
  7. are permitted provided that the following conditions are met:
  8.  
  9.    1. Redistributions of source code must retain the above copyright notice, 
  10.    this list of conditions and the following disclaimer.
  11.    2. Redistributions in binary form must reproduce the above copyright notice,
  12.    this list of conditions and the following disclaimer in the documentation 
  13.    and/or other materials provided with the distribution.
  14.  
  15. THIS SOFTWARE IS PROVIDED BY ANISH MISTRY ``AS IS'' AND ANY EXPRESS OR IMPLIED 
  16. WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
  17. AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 
  18. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
  19. OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  20. GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  21. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  22. TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  23. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24.  
  25. The views and conclusions contained in the software and documentation are those
  26. of the authors and should not be interpreted as representing official policies,
  27. either expressed or implied, of Anish Mistry or AM Productions.
  28.  
  29. * Variation of the FreeBSD License. http://www.freebsd.org/copyright/freebsd-license.html
  30. */
  31. //////////////////////////////////////////////////////////////////////
  32.  
  33. #include "stdafx.h"
  34. #include "MyComboBox.h"
  35.  
  36. //////////////////////////////////////////////////////////////////////
  37. // Construction/Destruction
  38. //////////////////////////////////////////////////////////////////////
  39.  
  40. CMyComboBox::CMyComboBox()
  41. {
  42.  
  43. }
  44.  
  45. CMyComboBox::~CMyComboBox()
  46. {
  47.  
  48. }
  49.  
  50. unsigned long int CMyComboBox::FindString(int nStartIndex, const char *pPrefix)
  51. {// begin FindString
  52.     return SendMessage(m_hWnd,CB_FINDSTRING,(WPARAM)nStartIndex,(LPARAM)pPrefix);
  53. }// end FindString
  54.  
  55. unsigned long int CMyComboBox::GetLBText(int nIndex,const char *pBuffer)
  56. {// begin GetLBText
  57.     return SendMessage(m_hWnd,CB_GETLBTEXT,(WPARAM)nIndex,(LPARAM)pBuffer);
  58. }// end GetLBText
  59.  
  60. unsigned long int CMyComboBox::GetLBTextLen(int nIndex)
  61. {// begin GetLBText
  62.     return SendMessage(m_hWnd,CB_GETLBTEXTLEN,(WPARAM)nIndex,(LPARAM)0);
  63. }// end GetLBText
  64.  
  65. unsigned long int CMyComboBox::SelectString(int nIndex,const char *pBuffer)
  66. {// begin GetLBText
  67.     return SendMessage(m_hWnd,CB_SELECTSTRING,(WPARAM)nIndex,(LPARAM)pBuffer);
  68. }// end GetLBText
  69.  
  70. unsigned long int CMyComboBox::SetEditSel(short int nStart,short int nEnd)
  71. {// begin SetEditSel
  72.     return SendMessage(m_hWnd,CB_SETEDITSEL,(WPARAM)0,(LPARAM)MAKELPARAM(nStart,nEnd));
  73. }// end SetEditSel
  74.  
  75. unsigned long int CMyComboBox::ShowDropDown(bool bShow)
  76. {// begin SetEditSel
  77.     return SendMessage(m_hWnd,CB_SHOWDROPDOWN,(WPARAM)bShow,(LPARAM)0);
  78. }// end SetEditSel
  79.  
  80. bool CMyComboBox::GetDroppedState(void)
  81. {// begin SetEditSel
  82.     return (bool)SendMessage(m_hWnd,CB_GETDROPPEDSTATE,(WPARAM)0,(LPARAM)0);
  83. }// end SetEditSel
  84.  
  85. void CMyComboBox::ResetContent(void)
  86. {// begin SetEditSel
  87.     SendMessage(m_hWnd,CB_RESETCONTENT,(WPARAM)0,(LPARAM)0);
  88. }// end SetEditSel
  89.  
  90. unsigned long int CMyComboBox::AddString(const char *pString)
  91. {// begin AddString
  92.     return SendMessage(m_hWnd,CB_ADDSTRING,(WPARAM)0,(LPARAM)pString);
  93. }// end AddString
  94.  
  95. unsigned long int CMyComboBox::GetCurSel(void)
  96. {// begin SetEditSel
  97.     return SendMessage(m_hWnd,CB_GETCURSEL,(WPARAM)0,(LPARAM)0);
  98. }// end SetEditSel
  99.  
  100. unsigned long int CMyComboBox::GetEditPos(void)
  101. {// begin GetEditPos
  102.     DWORD dwStart = 0;
  103.     DWORD dwEnd = 0;
  104.     SendMessage(m_hWnd,CB_GETEDITSEL,(WPARAM)&dwStart,(LPARAM)&dwEnd);
  105.     return dwStart;
  106. }// end GetEditPos
  107.