home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / samples / c13 / atlstrx / strx.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  564 b   |  27 lines

  1. // strX.cpp : Implementation of CstrX
  2. #include "stdafx.h"
  3. #include "ATLstrX.h"
  4. #include "strX.h"
  5.  
  6. #include <ctype.h>        // for tolower()
  7. #include <stdlib.h>
  8.  
  9. // CstrX
  10. // This function converts the BSTR pointed to by s to lower case.
  11. STDMETHODIMP CstrX::ATLstrlwrX(BSTR * s)
  12. {
  13.     // BSTRs are passed as wide characters.
  14.     // Also, in COM circumstances, they're null-terminated.
  15.     wchar_t *p = (wchar_t *) *s;
  16.     
  17.     // Iterate over the BSTR and convert its characters
  18.     // to lower case.
  19.     while (*p)
  20.     {
  21.         *p = tolower(*p);
  22.         p++;
  23.     }
  24.  
  25.     return S_OK;
  26. }
  27.