The Labs \ Source Viewer \ SSCLI \ Microsoft.JScript \ ActiveXObjectConstructor

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. namespace Microsoft.JScript
  16. {
  17.    
  18.     using System;
  19.     using System.Diagnostics;
  20.    
  21.     /// <summary>
  22.     /// Internal implementation of JScript's ActiveXObject constructor.
  23.     /// </summary>
  24.     /// <internalonly/>
  25.     public sealed class ActiveXObjectConstructor : ScriptFunction
  26.     {
  27.         static internal readonly ActiveXObjectConstructor ob = new ActiveXObjectConstructor();
  28.        
  29.         internal ActiveXObjectConstructor() : base(FunctionPrototype.ob, "ActiveXObject", 1)
  30.         {
  31.         }
  32.        
  33.         internal ActiveXObjectConstructor(LenientFunctionPrototype parent) : base(parent, "ActiveXObject", 1)
  34.         {
  35.             this.noExpando = false;
  36.         }
  37.        
  38.         internal override object Call(object[] args, object thisob)
  39.         {
  40.             return null;
  41.         }
  42.        
  43.         internal override object Construct(object[] args)
  44.         {
  45.             return this.CreateInstance(args);
  46.         }
  47.        
  48.         [JSFunctionAttribute(JSFunctionAttributeEnum.HasVarArgs)]
  49.         public new object CreateInstance(params object[] args)
  50.         {
  51.             // FEATURE_PAL doesn't support COM, so we just generate a runtime error here
  52.             throw new JScriptException(JSError.CantCreateObject);
  53.         }
  54.        
  55.         public object Invoke()
  56.         {
  57.             return null;
  58.         }
  59.        
  60.         internal override bool HasInstance(object ob)
  61.         {
  62.             if (ob is JSObject)
  63.                 return false;
  64.             return true;
  65.         }
  66.        
  67.     }
  68. }

Developer Fusion