Re: ActiveX Written in VB and used in VC
From: Alexander Nickolov (agnickolov_at_mvps.org)
Date: 10/05/04
- Next message: Igor Tandetnik: "Re: One more question on TSTs"
- Previous message: Tom Widmer: "Re: IsTextUnicode and Windows 98"
- In reply to: Bradley M. Small: "Re: ActiveX Written in VB and used in VC"
- Next in thread: Bradley M. Small: "Re: ActiveX Written in VB and used in VC"
- Reply: Bradley M. Small: "Re: ActiveX Written in VB and used in VC"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 5 Oct 2004 09:33:54 -0700
You never executed the equivalent of VB's New, so your variables
are understandably Nothing (put in VB terms). Why are you surprised?
Read the original reply more carefully.
-- ===================================== Alexander Nickolov Microsoft MVP [VC], MCSD email: agnickolov@mvps.org MVP VC FAQ: http://www.mvps.org/vcfaq ===================================== "Bradley M. Small" <BSmall@XNOSPAMXmjsi.com> wrote in message news:%23ypO1wtqEHA.3980@TK2MSFTNGP12.phx.gbl... > Mark -- > > Well I think this is going in the right direction, but not quite :( > > I've done this: > > _clsMyThingPtr oMyThing; > _clsMyThingFactPtr oMyThingFact; > > oMyThingLog = oMyThingFact->CreateMyThing( > (BSTR *)"Text1" > ,(BSTR *)"Text2" > ,(BSTR *)"Text3" > ,(BSTR *)"Text4" > ,(BSTR *)"Text5"); > > > oMyThing->DoSomethingIntersting((BSTR *) "9999",(BSTR *)"Test1", (BSTR > *)"Test2"); > > Of course now the interface is NULL and responds with an unhandled > exception > accordingly. > > It would appear that I am fine with making pointers to things, but what > they > are pointing to is not getting instantiated so they are null pointers. I > believe that CreateMyThing() will effectively create an instance of > _clsMyThingPtr, but I can't seem to call it until I can instantiate one of > them. > > I'm almost there I can taste it :) > > -- Bradley > > "Mark" <Mark@discussions.microsoft.com> wrote in message > news:490BA7BD-2102-4141-84EB-50959F26920C@microsoft.com... >> try this: >> _clsMyThingPtr oMyThing; >> hResult = oMyThing.CreateInstance(__uuidof(clsMyThing)); >> >> "Bradley M. Small" wrote: >> >> > I have written an ActiveX DLL in visual basic. It has 2 classes in it, > one >> > is a factory class declared as Global multiuse and the other is public > non >> > creatable. In VB I >> > >> > Dim oMyThing as clsMyThing >> > set oMyThing = clsThingFact.CreateMyThing(parm1, parm2, parm3, > parm4, >> > parm5) >> > >> > oMyThing.DoSomethignInteresting(parm) >> > >> > set oMyThing = nothing >> > >> > ---- >> > >> > This works fine, however, the program that is using it is now supposed > to be >> > written in Visual C++. To begin with I have not done any com stuff in > VC, >> > but I flipped the box in VB that makes the TLB, and put in #import >> > "c:\mypath\mytlb.tlb" no_namespace >> > >> > Of couse, my simply declaring one like: >> > >> > clsMyThing oMyThing; >> > >> > I get error C2079: 'oMyThing' uses undefined struct clsMyThing if I put > an >> > underscore on clsMyThing then I get that I can't instantiate an >> > abstract >> > class. >> > >> > Anyway, if someone can just get me pointed in the right direction and > push I >> > would really appreciate it. >> > >> > Thanks >> > >> > >> > > >
- Next message: Igor Tandetnik: "Re: One more question on TSTs"
- Previous message: Tom Widmer: "Re: IsTextUnicode and Windows 98"
- In reply to: Bradley M. Small: "Re: ActiveX Written in VB and used in VC"
- Next in thread: Bradley M. Small: "Re: ActiveX Written in VB and used in VC"
- Reply: Bradley M. Small: "Re: ActiveX Written in VB and used in VC"
- Messages sorted by: [ date ] [ thread ]