ACC: Calling RegQueryValue() to Get an OLE Object Class NameLast reviewed: June 6, 1997Article ID: Q99322 |
The information in this article applies to:
SUMMARYAdvanced: Requires expert coding, interoperability, and multiuser skills. The RegQueryValue() function, found in the Microsoft Windows SHELL.DLL file, uses an OLE ClassKey (such as PBRUSH or MSGRAPH) to obtain the information about that class from the REG.DAT file. This article describes the way the RegQueryValue() function obtains the Object Class Name from the OLE Registration Database REG.DAT file. Although only the procedure to obtain the Object Class Name is described here, other information, including the current location of the OLE server and the types of <Primary VERBS> available to the object, is also available.
MORE INFORMATIONNOTE: In the following sample code, an underscore (_) is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.
Declare Function RegQueryValue Lib "shell" (ByVal hkey&, _ ByVal SubKeyStr$, ByVal QueryStr$, Buffsize&) As Long Function GetObjectName$ (TheClassKey$) Dim ClassName$ ClassName$ = Space$(255) X& = CLng(Len(ClassName$)) cb = RegQueryValue(1, TheClassKey$, ClassName$, X&) GetObjectName$ = ClassName$ End FunctionThe sample function above declares a string to pass as a parameter for a return value in the RegQueryValue() function. RegQueryValue() has the following four parameters:
HKEY: The handle to a key that defines what type of information you want to retrieve lpszSubKey: A string that contains the OLE ClassKey that you want to look up lpszValue: A string in which to place the resulting value lpcb: The maximum length of the resulting stringTo use the sample function GetObjectName(), create a control on a form with the following properties:
ControlName: <ObjName> ControlSource: =GetObjectName ("PBRUSH")Any appropriate OLE ClassKey in the REG.DAT OLE database can be passed to the function.
REFERENCESFor more information about finding the ClassKey of an embedded object, please see the following article here in the Microsoft Knowledge Base:
ARTICLE-ID: Q99319 TITLE: ACC: Finding the OLE ClassKey of an Embedded Object (1.x, 2.0)Microsoft Windows "Programmer's Reference," version 3.1, Volume 2, page 282
|
Additional query words: classname class key
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |