Skip to content

Commit aa5ec86

Browse files
authored
Merge pull request #5812 from MicrosoftDocs/main
3/03/2025 AM Publish
2 parents b97072c + ca857b1 commit aa5ec86

File tree

2 files changed

+31
-32
lines changed

2 files changed

+31
-32
lines changed

docs/atl/reference/ccomcoclass-class.md

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,39 @@
11
---
2-
description: "Learn more about: CComCoClass Class"
32
title: "CComCoClass Class"
3+
description: "Learn more about: CComCoClass Class"
44
ms.date: "11/04/2016"
55
f1_keywords: ["CComCoClass", "ATLCOM/ATL::CComCoClass", "ATLCOM/ATL::CComCoClass::CreateInstance", "ATLCOM/ATL::CComCoClass::Error", "ATLCOM/ATL::CComCoClass::GetObjectCLSID", "ATLCOM/ATL::CComCoClass::GetObjectDescription"]
66
helpviewer_keywords: ["CComCoClass class", "aggregation [C++], aggregation models"]
7-
ms.assetid: 67cfefa4-8df9-47fa-ad58-2d1a1ae25762
87
---
98
# CComCoClass Class
109

1110
This class provides methods for creating instances of a class, and obtaining its properties.
1211

1312
## Syntax
1413

15-
```
14+
```cpp
1615
template <class T, const CLSID* pclsid = &CLSID_NULL>
1716
class CComCoClass
1817
```
1918
2019
#### Parameters
2120
22-
*T*<br/>
21+
*T*\
2322
Your class, derived from `CComCoClass`.
2423
25-
*pclsid*<br/>
24+
*pclsid*\
2625
A pointer to the CLSID of the object.
2726
2827
## Members
2928
3029
### Public Methods
3130
32-
|Name|Description|
33-
|----------|-----------------|
34-
|[CComCoClass::CreateInstance](#createinstance)|(Static) Creates an instance of the class and queries for an interface.|
35-
|[CComCoClass::Error](#error)|(Static) Returns rich error information to the client.|
36-
|[CComCoClass::GetObjectCLSID](#getobjectclsid)|(Static) Returns the object's class identifier.|
37-
|[CComCoClass::GetObjectDescription](#getobjectdescription)|(Static) Override to return the object's description.|
31+
| Name | Description |
32+
| ---------------------------------------------------------- | ----------------------------------------------------------------------- |
33+
| [CComCoClass::CreateInstance](#createinstance) | (Static) Creates an instance of the class and queries for an interface. |
34+
| [CComCoClass::Error](#error) | (Static) Returns rich error information to the client. |
35+
| [CComCoClass::GetObjectCLSID](#getobjectclsid) | (Static) Returns the object's class identifier. |
36+
| [CComCoClass::GetObjectDescription](#getobjectdescription) | (Static) Override to return the object's description. |
3837
3938
## Remarks
4039
@@ -58,23 +57,23 @@ You can override either of these defaults by specifying another macro in your cl
5857
5958
Use these `CreateInstance` functions to create an instance of a COM object and retrieve an interface pointer without using the COM API.
6059
61-
```
62-
template <class Q>
63-
static HRESULT CreateInstance( Q** pp);
60+
```cpp
61+
template <class Q>
62+
static HRESULT CreateInstance(Q** pp);
6463
65-
template <class Q>
64+
template <class Q>
6665
static HRESULT CreateInstance(IUnknown* punkOuter, Q** pp);
6766
```
6867

6968
### Parameters
7069

71-
*Q*<br/>
70+
*Q*\
7271
The COM interface that should be returned via *pp*.
7372

74-
*punkOuter*<br/>
73+
*punkOuter*\
7574
[in] The outer unknown or controlling unknown of the aggregate.
7675

77-
*pp*<br/>
76+
*pp*\
7877
[out] The address of a pointer variable that receives the requested interface pointer if creation succeeds.
7978

8079
### Return Value
@@ -101,7 +100,7 @@ In the following example, `CDocument` is a wizard-generated ATL class derived fr
101100

102101
This static function sets up the `IErrorInfo` interface to provide error information to the client.
103102

104-
```
103+
```cpp
105104
static HRESULT WINAPI Error(
106105
LPCOLESTR lpszDesc,
107106
const IID& iid = GUID_NULL,
@@ -130,7 +129,7 @@ static HRESULT WINAPI Error(
130129
UINT nID,
131130
const IID& iid = GUID_NULL,
132131
HRESULT hRes = 0,
133-
HINSTANCE hInst = _AtlBaseModule.GetResourceInstance ());
132+
HINSTANCE hInst = _AtlBaseModule.GetResourceInstance());
134133

135134
static HRESULT Error(
136135
UINT nID,
@@ -143,25 +142,25 @@ static HRESULT Error(
143142
144143
### Parameters
145144
146-
*lpszDesc*<br/>
145+
*lpszDesc*\
147146
[in] The string describing the error. The Unicode version of `Error` specifies that *lpszDesc* is of type LPCOLESTR; the ANSI version specifies a type of LPCSTR.
148147
149-
*iid*<br/>
148+
*iid*\
150149
[in] The IID of the interface defining the error or GUID_NULL (the default value) if the error is defined by the operating system.
151150
152-
*hRes*<br/>
151+
*hRes*\
153152
[in] The HRESULT you want returned to the caller. The default value is 0. For more details about *hRes*, see Remarks.
154153
155-
*nID*<br/>
154+
*nID*\
156155
[in] The resource identifier where the error description string is stored. This value should lie between 0x0200 and 0xFFFF, inclusively. In debug builds, an **ASSERT** will result if *nID* does not index a valid string. In release builds, the error description string will be set to "Unknown Error."
157156
158-
*dwHelpID*<br/>
157+
*dwHelpID*\
159158
[in] The help context identifier for the error.
160159
161-
*lpszHelpFile*<br/>
160+
*lpszHelpFile*\
162161
[in] The path and name of the help file describing the error.
163162
164-
*hInst*<br/>
163+
*hInst*\
165164
[in] The handle to the resource. By default, this parameter is `_AtlModule::GetResourceInstance`, where `_AtlModule` is the global instance of [CAtlModule](../../atl/reference/catlmodule-class.md).
166165
167166
### Return Value
@@ -178,7 +177,7 @@ If the *hRes* parameter is nonzero, then `Error` returns the value of *hRes*. If
178177
179178
Provides a consistent way of retrieving the object's CLSID.
180179
181-
```
180+
```cpp
182181
static const CLSID& WINAPI GetObjectCLSID();
183182
```
184183

@@ -190,7 +189,7 @@ The object's class identifier.
190189

191190
This static function retrieves the text description for your class object.
192191

193-
```
192+
```cpp
194193
static LPCTSTR WINAPI GetObjectDescription();
195194
```
196195

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
> [!IMPORTANT]
2-
> The Visual Studio compilers and build tools can report many kinds of errors and warnings. After an error or warning is found, the build tools may make assumptions about code intent and attempt to continue, so that more issues can be reported at the same time. If the tools make the wrong assumption, later errors or warnings may not apply to your project. When you correct issues in your project, always start with the first error or warning that's reported, and rebuild often. One fix may make many subsequent errors go away.
2+
> The Visual Studio compilers and build tools can report many kinds of errors and warnings. After an error or warning is found, the build tools may make assumptions about code intent and attempt to continue, so that more issues can be reported at the same time. If the tools make the wrong assumption, later errors or warnings may not apply to your project. When you correct issues in your project, always start with the first error or warning that's reported, and rebuild often. One fix may resolve multiple subsequent errors.
33
44
To get help on a particular diagnostic message in Visual Studio, select it in the **Output** window and press the **F1** key. Visual Studio opens the documentation page for that error, if one exists. You can also use the search tool at the top of the page to find articles about specific errors or warnings. Or, browse the list of errors and warnings by tool and type in the table of contents on this page.
55

66
> [!NOTE]
7-
> Not every Visual Studio error or warning is documented. In many cases, the diagnostic message provides all of the information that's available. If you landed on this page when you used **F1** and you think the error or warning message needs additional explanation, let us know. You can use the feedback buttons on this page to raise a documentation issue on [GitHub](https://github.com/MicrosoftDocs/cpp-docs/issues). If you think the error or warning is wrong, or you've found another problem with the toolset, report a product issue on the [Developer Community](https://aka.ms/feedback/report?space=62) site. You can also send feedback and enter bugs within the IDE. In Visual Studio, go to the menu bar and choose **Help > Send Feedback > Report a Problem**, or submit a suggestion by using **Help > Send Feedback > Send a Suggestion**. Some compiler error topics were created that are not emitted by the compiler and now redirect to this page instead.
7+
> Not every Visual Studio error or warning is documented. In many cases, the diagnostic message provides all of the information that's available. If you landed on this page and think the error or warning message needs additional explanation, let us know by using the feedback buttons on this page. If you think the error or warning is wrong, or you've found another problem with the toolset, report a product issue on the [Developer Community](https://aka.ms/feedback/report?space=62) site. You can also send feedback and enter bugs within the IDE. In Visual Studio, go to the menu bar and choose **Help > Send Feedback > Report a Problem**, or submit a suggestion by using **Help > Send Feedback > Suggest a Feature**. Some compiler error topics were created that are not emitted by the compiler and now redirect to this page instead.
88
9-
You may find additional assistance for errors and warnings in [Microsoft Learn Q&A](/answers/topics/c%2B%2B.html) forums. Or, search for the error or warning number on the Visual Studio C++ [Developer Community](https://aka.ms/vsfeedback/browsecpp) site. You can also search [Stack Overflow](https://stackoverflow.com/) to find solutions.
9+
You may find additional assistance for errors and warnings in [Microsoft Q&A C++](/answers/tags/314/cpp) forums. Or, search for the error or warning number on the Visual Studio C++ [Developer Community](https://aka.ms/vsfeedback/browsecpp) site. You can also search [Stack Overflow](https://stackoverflow.com/) to find solutions.
1010

1111
For links to additional help and community resources, see [Visual C++ Help and Community](../../overview/visual-cpp-help-and-community.md).

0 commit comments

Comments
 (0)