Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
2.0 KiB

  1. #include "precomp.h"
  2. #include "ComboBoxEx.h"
  3. int ComboBoxEx_FindMember( HWND hwnd, int iStart, MEMBER_CHANNEL_ID *pMemberID)
  4. {
  5. int iSize = ComboBoxEx_GetCount( hwnd );
  6. COMBOBOXEXITEM cbexFind;
  7. if( iStart < 0 )
  8. {
  9. iStart = 0;
  10. }
  11. for( int i = iStart; i < iSize; i++ )
  12. {
  13. ClearStruct(&cbexFind);
  14. cbexFind.iItem = i;
  15. cbexFind.mask = CBEIF_LPARAM;
  16. if( ComboBoxEx_GetItem( hwnd, &cbexFind ) )
  17. {
  18. MEMBER_CHANNEL_ID *_pMemberID;
  19. _pMemberID = (MEMBER_CHANNEL_ID*)cbexFind.lParam;
  20. if( _pMemberID != pMemberID ) continue;
  21. }
  22. else
  23. {
  24. return -1;
  25. }
  26. return i;
  27. }
  28. return -1;
  29. }
  30. T120NodeID ComboBoxEx_GetNodeIDFromSendID( HWND hwnd, T120UserID userID )
  31. {
  32. int iSize = ComboBoxEx_GetCount( hwnd );
  33. COMBOBOXEXITEM cbexFind;
  34. int iStart = 0;
  35. for( int i = iStart; i < iSize; i++ )
  36. {
  37. ClearStruct(&cbexFind);
  38. cbexFind.iItem = i;
  39. cbexFind.mask = CBEIF_LPARAM;
  40. if( ComboBoxEx_GetItem( hwnd, &cbexFind ) )
  41. {
  42. T120UserID _userID;
  43. _userID = (cbexFind.lParam)?((MEMBER_CHANNEL_ID*)(cbexFind.lParam))->nSendId : 0;
  44. if( userID != _userID ) continue;
  45. }
  46. else
  47. {
  48. return 0;
  49. }
  50. return (cbexFind.lParam)?((MEMBER_CHANNEL_ID*)(cbexFind.lParam))->nNodeId : 0;
  51. }
  52. return 0;
  53. }
  54. T120NodeID ComboBoxEx_GetNodeIDFromPrivateSendID( HWND hwnd, T120UserID userID )
  55. {
  56. int iSize = ComboBoxEx_GetCount( hwnd );
  57. COMBOBOXEXITEM cbexFind;
  58. int iStart = 0;
  59. for( int i = iStart; i < iSize; i++ )
  60. {
  61. ClearStruct(&cbexFind);
  62. cbexFind.iItem = i;
  63. cbexFind.mask = CBEIF_LPARAM;
  64. if( ComboBoxEx_GetItem( hwnd, &cbexFind ) )
  65. {
  66. T120UserID _userID;
  67. _userID = (cbexFind.lParam)?((MEMBER_CHANNEL_ID*)(cbexFind.lParam))->nPrivateSendId : 0;
  68. if( userID != _userID ) continue;
  69. }
  70. else
  71. {
  72. return 0;
  73. }
  74. return (cbexFind.lParam)?((MEMBER_CHANNEL_ID*)(cbexFind.lParam))->nNodeId : 0;
  75. }
  76. return 0;
  77. }
  78. void ComboBoxEx_SetHeight( HWND hwnd, int iHeight )
  79. {
  80. HWND hwndCombo = (HWND)SNDMSG( hwnd, CBEM_GETCOMBOCONTROL, 0, 0 );
  81. ::SetWindowPos( hwndCombo, NULL, 0, 0, 0, iHeight, SWP_NOMOVE | SWP_NOACTIVATE );
  82. }