Leaked source code of windows server 2003
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.

51 lines
798 B

  1. #ifndef WIN32_LEAN_AND_MEAN
  2. #define WIN32_LEAN_AND_MEAN
  3. #endif
  4. #include <windows.h>
  5. #include <windowsx.h>
  6. #include "dbg.h"
  7. #include "cddbitem.h"
  8. CDDBItem::CDDBItem()
  9. {
  10. m_lpwstrText = NULL;
  11. m_hIcon = NULL;
  12. }
  13. CDDBItem::~CDDBItem()
  14. {
  15. if(m_lpwstrText) {
  16. MemFree(m_lpwstrText);
  17. m_lpwstrText = NULL;
  18. }
  19. }
  20. LPWSTR CDDBItem::SetTextW(LPWSTR lpwstr)
  21. {
  22. if(m_lpwstrText) {
  23. MemFree(m_lpwstrText);
  24. }
  25. m_lpwstrText = StrdupW(lpwstr);
  26. return m_lpwstrText;
  27. }
  28. LPWSTR CDDBItem::GetTextW(VOID)
  29. {
  30. return m_lpwstrText;
  31. }
  32. LPSTR CDDBItem::GetTextA(VOID)
  33. {
  34. if(!m_lpwstrText) {
  35. return NULL;
  36. }
  37. WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK,
  38. m_lpwstrText, -1,
  39. m_szTmpStr, sizeof(m_szTmpStr),
  40. NULL, NULL);
  41. return m_szTmpStr;
  42. }