home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / source / chap03 / lst33use / lst33use.cpp next >
Encoding:
C/C++ Source or Header  |  1996-09-19  |  1.1 KB  |  59 lines

  1.  
  2. #include <objbase.h>
  3. #include <initguid.h>
  4. #include <stdio.h>
  5.  
  6. /*class IUpperStr    : public IUnknown
  7. {
  8. public:
  9.     virtual STDMETHODIMP_(char *) Upper(char *) = 0;
  10. };
  11.  
  12. const CLSID CLSID_CUpperStr =
  13. { 0x80fa6ee0, 0x120, 0x11d0, {0xa6, 0xa0, 0x0, 0xaa, 0x0, 0x60, 0x25, 0x53}};
  14.  
  15. const CLSID IID_IUpperStr =
  16. { 0x80fa6ee2, 0x120, 0x11d0, {0xa6, 0xa0, 0x0, 0xaa, 0x0, 0x60, 0x25, 0x53}};
  17. */
  18.  
  19. // These equivalent definition will be from lst33_i.c
  20.  
  21.  
  22. #include "..\lst33\lst33.h"
  23.  
  24.  
  25. void main()
  26. {
  27.  
  28.     HRESULT hr;
  29.      ILst33  * m_pILst33; // interface pointer    
  30.     CLSID    clsid;
  31.  
  32.  
  33.  
  34.     hr = CoInitialize(NULL);
  35.     hr = CLSIDFromProgID(L"LST33.Lst33Object.1",&clsid);
  36.  
  37.     hr = CoCreateInstance(clsid,
  38.                             NULL,
  39.                             CLSCTX_INPROC_SERVER,
  40.                             IID_ILst33,
  41.                             (LPVOID*)&m_pILst33);
  42.  
  43.     if(FAILED(hr))
  44.     {
  45.         printf("can not create Lst33");
  46.         CoUninitialize();
  47.         return;
  48.     }
  49.     
  50.     char *lpLowerString;
  51.  
  52.  
  53.     m_pILst33->Lower("HELLO", &lpLowerString );
  54.  
  55.     printf("the return string is %s\n", lpLowerString);
  56.  
  57.     m_pILst33->Release();
  58.     CoUninitialize();    
  59. }