If that's your complete code, you're missing the "parameterless constructor"
(that the template you quoted in a later message said was required).
Remember that COM does not support the concept of "static methods" -- you
always need to create an instance to do anything with COM.
At 11:40 PM 11/24/2005, G G wrote
>I was trying C# for COM component writing in visucal studio 2005 express
>beta 2
>
>I probably should unistall everyting and install the real one but don't
>want to do that work until I get the new disk drives/PC in a month or so.
>
>I had the proejct proerty set to class lib, default classname set, COM
>visible check.
>
>I was able to compile but did not get to call the class via vbscript -
>could not find the class.
>After some tweaking, I was able to get vbscript to create the object ofr
>the class but can not call nay ufnciton.
>
>I got the following code:
>
>
>using System;
>using System.Collections.Generic;
>using System.Text;
>using System.Text.RegularExpressions;
>using System.Reflection;
>using System.Runtime.CompilerServices;
>using System.Runtime.InteropServices;
>
>[Guid(guid), ComVisible(true)]
>//[ComSourceInterfaces( SomeClass.ClassId, SomeClass.InterfaceId,
>SomeClass.EventsId)]
>
> public class SomeClass
> {
> #region COM_GUIDs definition
> public const string guid = "9b4d2768-b95e-42d7-8cba-3027f154b1c8";
> /* These GUIDs provide the COM identity for this class
> ' and its COM interfaces. If you change them, existing
> ' clients will no longer be able to access the class.
> * */
> #endregion
>
>
> [ComVisible(true)] // did not make any difference
> public int testInt() // still call invoke this testInt from
>vbscript
> {
> return 6999;
> }
>
> public int ReturnStringArray(String sIn, out String[] newStrs)
> {
> newStrs = sIn.Split(' ');
> return newStrs.Length;
> }
>
> public int testscalar(String sIn, out String newStrs)
> {
> String[] strs = sIn.Split(' ');
> newStrs = strs[0];
> return newStrs.Length;
> }
> public int testBStr(String sIn, ref BStrWrapper[] newStrs)
> {
> int i = 0;
> foreach (String s in sIn.Split(' '))
> {
> newStrs[i] = new BStrWrapper(s);
> i++;
> }
> //return newStrs.Length;
> return i;
> }
> }
>
>
>what did I miss?
J. Merrill / Analytical Software Corp
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com