mbsvc.cpp 897 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include "precomp.h"
  2. #include <direct.h>
  3. #include "mbsvc.h"
  4. #ifndef _WASABIRUNTIME
  5. BEGIN_SERVICES(MbSvc_Svc);
  6. DECLARE_SERVICETSINGLE(svc_miniBrowser, MbSvc);
  7. END_SERVICES(MbSvc_Svc, _MbSvc_Svc);
  8. #ifdef _X86_
  9. extern "C" { int _link_MbSvc; }
  10. #else
  11. extern "C" { int __link_MbSvc; }
  12. #endif
  13. #endif
  14. MbSvc::MbSvc()
  15. {
  16. BrowserWnd::InitializeLibrary();
  17. }
  18. MbSvc::~MbSvc()
  19. {
  20. BrowserWnd::UninitializeLibrary();
  21. }
  22. int MbSvc::testGuid(GUID g) {
  23. return (g == GUID_MINIBROWSER_ANY || g == GUID_MINIBROWSER_IEACTIVEX);
  24. }
  25. MiniBrowser *MbSvc::createMiniBrowser() {
  26. BrowserWnd *w = new BrowserWnd;
  27. browsers.addItem(w);
  28. return w;
  29. }
  30. void MbSvc::destroyMiniBrowser(MiniBrowser *b) {
  31. ASSERT(b != NULL);
  32. BrowserWnd *bw = static_cast<BrowserWnd *>(b->minibrowser_getRootWnd());
  33. ASSERT(bw != NULL);
  34. int i = browsers.searchItem(bw);
  35. if (i < 0) return;
  36. browsers.removeByPos(i);
  37. delete bw;
  38. }