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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CreateInstance() Fails…

Status
Not open for further replies.

d00ape

Programmer
Apr 2, 2003
171
SE
I’ve got a .dll from my supplier that I am trying to create a instance of. (I’m not realy good att dll’s).

How may I search for errors when my call to: CreateInstance(…) fails

I know it would return a HRESULT and that the value is 1 on those cpu-s which it don’t work on. The call work properly on my developing machine.

I surely have registered the dll on those cpu-s the call fails.

Pleased for any suggestions…


APe
 
try to do in console at the first a
regsvr32 yourdll.dll


Ion Filipski
1c.bmp
 
I've done that.

Eaven:
regsvr32 -u mydll.dll

and then:
regsvr32 mydll.dll



APe
 
Please supply the full call context (at least CreateInstance and its parameters).
 
I can't understanmd where do you call CreateInstance and it fails? I don't know your context. CreateInstance is a callback method and you never call it directly...

Ion Filipski
1c.bmp
 
CreateInstance is a COM/DCOM/COM+ specific call. Are you sure you're doing the right thing? If it is about COM, post your message here If else, are you sure you did not mean LoadLibrary ?!

If you really meant CreateInstance, why don't you try using CoCreateInstance and wrap it up in a CComPtr or in a CComQIPtr ?

Again, please provide the parameters :)
 
CreateInstance is a member of IClassFactory. You never call this method directly. The standard method to create an instance is CoCreateIsntance, which result more calls, one of them is IClassFactory::CreateInstance. I think before I would past a half of MSDN here, you should open MSDN by yourself and maybe some manuals.

Ion Filipski
1c.bmp
 
CreateInstance is not only a member of IClassFactory, but of IObjectContext, ITransactionContextEx and so forth and so on (don't remember all of them and today I am too lazy to search on the net).

I still wait for more details from d00ape :)
 
Anyway, I think d00ape try to call this method directly in some way, without doing it by using COM API, or something like that...

Ion Filipski
1c.bmp
 
Hi again. Been away for illness.
Heres my code:


#import "MultiUseDataBase.dll"
...

CoInitialize(NULL);

// Create intstance to component
if( hres = m_IPtr.CreateInstance("MultiUseDataBase.MultiUseDataBase") == S_OK)
{
// ALL OK
}
else
{
// This happens on stuggling CPUs
}
 
More correctly is to do like this:
if(SUCCEEDED(m_IPtr.CreateInstance
("MultiUseDataBase.MultiUseDataBase"))
{
//is ok
}else
{
//is not ok
}

Is quite the same, but more correctly.
Maybe your dll tries to load anothe dll that is missing or it has some specific requirements?


Ion Filipski
1c.bmp
 
Ion wrote:
--------
Maybe your dll tries to load anothe dll that is missing or it has some specific requirements?
--------

I now think thats the problem. I've got a new version of the dll from ny suppiler and run:

regsvr32 TheDll.dll

Do I have to remove the old dll from the registry or something first?


 
maybe, but is enouigh you only to create the instance of only a several version, look in registry for

MultiUseDataBase.MultiUseDataBase
and maybe there are many versions
MultiUseDataBase.MultiUseDataBase.1
MultiUseDataBase.MultiUseDataBase.2
...


Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top