Skip to content

Commit 15a4fde

Browse files
author
jguptaso
committed
Added tutorial for demonstarting COM properties
1 parent dccbb43 commit 15a4fde

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1942
-1
lines changed

COM Properties/prop/Debug/prop.dll

40.5 KB
Binary file not shown.

COM Properties/prop/Debug/prop.lib

1.46 KB
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 10.00
3+
# Visual Studio 2008
4+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UseofFactory", "UseofFactory\UseofFactory.vcproj", "{4E503EF4-69C9-454C-84D1-5E6798503F38}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|Win32 = Debug|Win32
9+
Release|Win32 = Release|Win32
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{4E503EF4-69C9-454C-84D1-5E6798503F38}.Debug|Win32.ActiveCfg = Debug|Win32
13+
{4E503EF4-69C9-454C-84D1-5E6798503F38}.Debug|Win32.Build.0 = Debug|Win32
14+
{4E503EF4-69C9-454C-84D1-5E6798503F38}.Release|Win32.ActiveCfg = Release|Win32
15+
{4E503EF4-69C9-454C-84D1-5E6798503F38}.Release|Win32.Build.0 = Release|Win32
16+
EndGlobalSection
17+
GlobalSection(SolutionProperties) = preSolution
18+
HideSolutionNode = FALSE
19+
EndGlobalSection
20+
EndGlobal
10.5 KB
Binary file not shown.
4.15 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"></assembly>
243 KB
Binary file not shown.
140 KB
Binary file not shown.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#include <windows.h>
2+
#include "..\..\prop\prop.h"
3+
#include <iostream>
4+
#include <conio.h>
5+
using namespace std;
6+
7+
IClassFactory* pIClassFactory = NULL;
8+
IFirst* pIFirst = NULL;
9+
ISecond* pISecond = NULL;
10+
11+
int
12+
main(
13+
)
14+
{
15+
HRESULT hr;
16+
17+
CoInitialize(NULL);
18+
hr = CoGetClassObject(
19+
CLSID_CPropertyClass,
20+
CLSCTX_INPROC_SERVER,
21+
NULL, // this parameter is used in DCOM CoServerInfo
22+
IID_IClassFactory,
23+
(void**)&pIClassFactory
24+
);
25+
26+
if(SUCCEEDED(hr))
27+
{
28+
hr = pIClassFactory->CreateInstance(NULL, IID_IFirst, (void**)&pIFirst);
29+
if(FAILED(hr))
30+
{
31+
cout<<" \n Createinstace failed.";
32+
}
33+
34+
}
35+
36+
hr = pIFirst->FirstFunction();
37+
pIFirst->Release();
38+
39+
pIClassFactory->LockServer(TRUE);
40+
// 10,000 lines of code
41+
Sleep(5000);
42+
43+
hr = pIClassFactory->CreateInstance(NULL, IID_ISecond, (void**)&pISecond);
44+
if(FAILED(hr))
45+
{
46+
cout<<" \n Createinstace failed.";
47+
}
48+
49+
hr = pISecond->SecondFunction();
50+
pISecond->Release();
51+
52+
// workdone
53+
pIClassFactory->LockServer(FALSE);
54+
pIClassFactory->Release();
55+
56+
CoUninitialize();
57+
_getch();
58+
return 0;
59+
}
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
<?xml version="1.0" encoding="Windows-1252"?>
2+
<VisualStudioProject
3+
ProjectType="Visual C++"
4+
Version="9.00"
5+
Name="UseofFactory"
6+
ProjectGUID="{4E503EF4-69C9-454C-84D1-5E6798503F38}"
7+
RootNamespace="UseofFactory"
8+
Keyword="Win32Proj"
9+
TargetFrameworkVersion="196613"
10+
>
11+
<Platforms>
12+
<Platform
13+
Name="Win32"
14+
/>
15+
</Platforms>
16+
<ToolFiles>
17+
</ToolFiles>
18+
<Configurations>
19+
<Configuration
20+
Name="Debug|Win32"
21+
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
22+
IntermediateDirectory="$(ConfigurationName)"
23+
ConfigurationType="1"
24+
CharacterSet="1"
25+
>
26+
<Tool
27+
Name="VCPreBuildEventTool"
28+
/>
29+
<Tool
30+
Name="VCCustomBuildTool"
31+
/>
32+
<Tool
33+
Name="VCXMLDataGeneratorTool"
34+
/>
35+
<Tool
36+
Name="VCWebServiceProxyGeneratorTool"
37+
/>
38+
<Tool
39+
Name="VCMIDLTool"
40+
/>
41+
<Tool
42+
Name="VCCLCompilerTool"
43+
Optimization="0"
44+
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
45+
MinimalRebuild="true"
46+
BasicRuntimeChecks="3"
47+
RuntimeLibrary="3"
48+
UsePrecompiledHeader="0"
49+
WarningLevel="3"
50+
DebugInformationFormat="4"
51+
/>
52+
<Tool
53+
Name="VCManagedResourceCompilerTool"
54+
/>
55+
<Tool
56+
Name="VCResourceCompilerTool"
57+
/>
58+
<Tool
59+
Name="VCPreLinkEventTool"
60+
/>
61+
<Tool
62+
Name="VCLinkerTool"
63+
LinkIncremental="2"
64+
GenerateDebugInformation="true"
65+
SubSystem="1"
66+
TargetMachine="1"
67+
/>
68+
<Tool
69+
Name="VCALinkTool"
70+
/>
71+
<Tool
72+
Name="VCManifestTool"
73+
/>
74+
<Tool
75+
Name="VCXDCMakeTool"
76+
/>
77+
<Tool
78+
Name="VCBscMakeTool"
79+
/>
80+
<Tool
81+
Name="VCFxCopTool"
82+
/>
83+
<Tool
84+
Name="VCAppVerifierTool"
85+
/>
86+
<Tool
87+
Name="VCPostBuildEventTool"
88+
/>
89+
</Configuration>
90+
<Configuration
91+
Name="Release|Win32"
92+
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
93+
IntermediateDirectory="$(ConfigurationName)"
94+
ConfigurationType="1"
95+
CharacterSet="1"
96+
WholeProgramOptimization="1"
97+
>
98+
<Tool
99+
Name="VCPreBuildEventTool"
100+
/>
101+
<Tool
102+
Name="VCCustomBuildTool"
103+
/>
104+
<Tool
105+
Name="VCXMLDataGeneratorTool"
106+
/>
107+
<Tool
108+
Name="VCWebServiceProxyGeneratorTool"
109+
/>
110+
<Tool
111+
Name="VCMIDLTool"
112+
/>
113+
<Tool
114+
Name="VCCLCompilerTool"
115+
Optimization="2"
116+
EnableIntrinsicFunctions="true"
117+
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
118+
RuntimeLibrary="2"
119+
EnableFunctionLevelLinking="true"
120+
UsePrecompiledHeader="0"
121+
WarningLevel="3"
122+
DebugInformationFormat="3"
123+
/>
124+
<Tool
125+
Name="VCManagedResourceCompilerTool"
126+
/>
127+
<Tool
128+
Name="VCResourceCompilerTool"
129+
/>
130+
<Tool
131+
Name="VCPreLinkEventTool"
132+
/>
133+
<Tool
134+
Name="VCLinkerTool"
135+
LinkIncremental="1"
136+
GenerateDebugInformation="true"
137+
SubSystem="1"
138+
OptimizeReferences="2"
139+
EnableCOMDATFolding="2"
140+
TargetMachine="1"
141+
/>
142+
<Tool
143+
Name="VCALinkTool"
144+
/>
145+
<Tool
146+
Name="VCManifestTool"
147+
/>
148+
<Tool
149+
Name="VCXDCMakeTool"
150+
/>
151+
<Tool
152+
Name="VCBscMakeTool"
153+
/>
154+
<Tool
155+
Name="VCFxCopTool"
156+
/>
157+
<Tool
158+
Name="VCAppVerifierTool"
159+
/>
160+
<Tool
161+
Name="VCPostBuildEventTool"
162+
/>
163+
</Configuration>
164+
</Configurations>
165+
<References>
166+
</References>
167+
<Files>
168+
<Filter
169+
Name="Source Files"
170+
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
171+
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
172+
>
173+
<File
174+
RelativePath=".\DemoFacory.cpp"
175+
>
176+
</File>
177+
</Filter>
178+
<Filter
179+
Name="Header Files"
180+
Filter="h;hpp;hxx;hm;inl;inc;xsd"
181+
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
182+
>
183+
</Filter>
184+
<Filter
185+
Name="Resource Files"
186+
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
187+
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
188+
>
189+
</Filter>
190+
</Files>
191+
<Globals>
192+
</Globals>
193+
</VisualStudioProject>

0 commit comments

Comments
 (0)