Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More COM Problems

Status
Not open for further replies.

Valius

Programmer
Oct 20, 2000
174
US
I've got some COM objects in a .h file:

Base.h file

IEICUserPtr User;

I then include the .h file in my main program and from my main program delcare them like this:

Program.cpp

void init()
{
extern IEICUserPtr User;
User.CreateInstance(__uuidof(EICUser));
}

This goes fine an dandy...but then in another function, I try and get that variable back by doing this:

Program.cpp

void GetInfo()
{
extern IEICUserPtr User;
User->PutId("NWW");
}

Which then throws an exception. If I do this right after I create my COM object int he same function there is no problem...so my guess is that it's not keeping the variable intact like I think it should. I have other variables that I do the same thing with, but that info stays intact. Any ideas as to why this COM Ptr isn't keeping the info and what I need to do to make it stay intact? Thanks in advance!

Niky Williams
NTS Marketing
 
Okay, you can officially label me as an IDIOT. I was trying to declare an extern variable where it wasn't needed....it's days like these that I wonder why I'm a programmer.

Niky Williams
NTS Marketing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top