[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Creating ActiveX reference with the CLSID

Posted on 2001-07-13
12
Medium Priority
?
523 Views
Last Modified: 2012-05-04
How can I get the app name and class name from the CLSID?  I want to do a CreateObject() but I don't know the application name and class of the object to create.  I only know the CLSID.  Thanks.
0
Comment
Question by:dfc106
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 3

Expert Comment

by:jrspano
ID: 6281554
search the registry it should tell you.  hkey classes root and then look under appid they should be in there
0
 

Author Comment

by:dfc106
ID: 6281576
I need to do this programmatically.  Searching the registry would be too slow.
0
 
LVL 3

Expert Comment

by:jrspano
ID: 6281589
it is near instantaneous on a pentium 166.  that is a pretty slow cpu.  If you know the clsid in advance why don't you just find it in your registry and then code it in your project. where are you getting the clsid from?

as for programmatically I don't think that is possible.  the only place i know of on a cpu that that info is stored is the registry.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:dfc106
ID: 6281625
I don't know the clsid in advance.  I'm hoping there is some function to dig the value out of the registry for me.  I could write the function to do it, but I'm lazy, and it probably wouldn't be as efficient as it could be.
0
 
LVL 3

Expert Comment

by:jrspano
ID: 6281631
if you don't know the clsid or the name of the component how do you know what to load at all??
0
 

Author Comment

by:dfc106
ID: 6281661
I'm getting the clsid out of a database at runtime.  As far as searching the registry; try taking the clsid of the last entry in your hkey_classes_root key then search for it.  Way too slow.  I either need a function that can quickly locate it, or I need to know how I can search for it myself efficiently.
0
 
LVL 3

Expert Comment

by:jrspano
ID: 6281692
is it your db?  if so modify it to include the componet names.  there isn't a way to just return the component name from the class id.  you are stuck with searching the registry.  If you use the registry api's it is fast.  you already know the location of the ids hkeyclassesroot/appid.
0
 
LVL 5

Expert Comment

by:KDivad
ID: 6282524
A quick look at my registry tells me that you can open the default value at either:

HKCR\CLSID\ & ClassIDFromDB
-or-
HKCR\CLSID\ & ClassIDFromDB & "\ProgID"

and that will be the name of what you can pass to CreateObject.

This gets me the name of my own components and several that aren't my own. A bit of practice should tell you which is more reliable...
0
 

Author Comment

by:dfc106
ID: 6282750
Thanks guys but here is the answer I was looking for:

Private Declare Function ProgIDFromCLSID _
   Lib "ole32.dll" (pCLSID As GUID, lpszProgID As Long) As Long

There is a good example at:
http://support.microsoft.com/support/kb/articles/Q183/5/44.ASP
0
 
LVL 3

Expert Comment

by:jrspano
ID: 6285521
cool you learn something every day!
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7153419
Hi dfc106,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

dfc106, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 7182144
Placed in PAQ

Computer101
E-E Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question