Skip to content

Commit 83919ce

Browse files
author
U-NVIDIA.COM\sahils
committed
about3 project from charles petzold done
1 parent 4e03ba1 commit 83919ce

33 files changed

+370
-0
lines changed

About3/About3.c

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
#include <Windows.h>
2+
#include "resource.h"
3+
4+
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
5+
BOOL CALLBACK AboutDlgProc(HWND, UINT, WPARAM, LPARAM);
6+
LRESULT CALLBACK EllipPushWndProc(HWND, UINT, WPARAM, LPARAM);
7+
8+
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
9+
{
10+
static TCHAR szAppName[] = TEXT("About3");
11+
MSG msg;
12+
HWND hwnd;
13+
WNDCLASS wndclass;
14+
15+
wndclass.style = CS_HREDRAW | CS_VREDRAW;
16+
wndclass.lpfnWndProc = WndProc;
17+
wndclass.cbClsExtra = 0;
18+
wndclass.cbWndExtra = 0;
19+
wndclass.hInstance = hInstance;
20+
wndclass.hIcon = LoadIcon(hInstance, szAppName);
21+
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
22+
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
23+
wndclass.lpszMenuName = szAppName;
24+
wndclass.lpszClassName = szAppName;
25+
26+
if (!RegisterClass(&wndclass))
27+
{
28+
MessageBox(NULL, TEXT("RegisterClass() Error"), szAppName, MB_ICONERROR);
29+
return 0;
30+
}
31+
32+
wndclass.style = CS_HREDRAW | CS_VREDRAW;
33+
wndclass.lpfnWndProc = EllipPushWndProc;
34+
wndclass.cbClsExtra = 0;
35+
wndclass.cbWndExtra = 0;
36+
wndclass.hInstance = hInstance;
37+
wndclass.hIcon = NULL;
38+
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
39+
wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
40+
wndclass.lpszMenuName = NULL;
41+
wndclass.lpszClassName = TEXT("EllipPush");
42+
43+
if (!RegisterClass(&wndclass))
44+
{
45+
MessageBox(NULL, TEXT("RegisterClass() Error"), TEXT("EllipPush"), MB_ICONERROR);
46+
return 0;
47+
}
48+
49+
hwnd = CreateWindow(szAppName, TEXT("About Box Demo Program"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
50+
51+
ShowWindow(hwnd, iCmdShow);
52+
UpdateWindow(hwnd);
53+
54+
while (GetMessage(&msg, NULL, 0, 0))
55+
{
56+
TranslateMessage(&msg);
57+
DispatchMessage(&msg);
58+
}
59+
60+
return (int)msg.wParam;
61+
}
62+
63+
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
64+
{
65+
static HINSTANCE hInstance;
66+
67+
switch (message)
68+
{
69+
case WM_CREATE:
70+
{
71+
hInstance = ((LPCREATESTRUCT)lParam)->hInstance;
72+
return 0;
73+
}
74+
break;
75+
case WM_COMMAND:
76+
{
77+
switch (LOWORD(wParam))
78+
{
79+
case IDM_APP_ABOUT:
80+
{
81+
DialogBox(hInstance, TEXT("AboutBox"), hwnd, AboutDlgProc);
82+
return 0;
83+
}
84+
break;
85+
default:
86+
break;
87+
}
88+
}
89+
break;
90+
case WM_DESTROY:
91+
PostQuitMessage(0);
92+
return 0;
93+
default:
94+
break;
95+
}
96+
97+
return DefWindowProc(hwnd, message, wParam, lParam);
98+
}
99+
100+
BOOL CALLBACK AboutDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
101+
{
102+
switch (message)
103+
{
104+
case WM_INITDIALOG:
105+
return TRUE;
106+
case WM_COMMAND:
107+
{
108+
switch (LOWORD(wParam))
109+
{
110+
case IDOK:
111+
EndDialog(hDlg, 0);
112+
return TRUE;
113+
default:
114+
break;
115+
}
116+
}
117+
break;
118+
default:
119+
break;
120+
}
121+
122+
return FALSE;
123+
}
124+
125+
LRESULT CALLBACK EllipPushWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
126+
{
127+
TCHAR szText[40];
128+
HBRUSH hBrush;
129+
HDC hdc;
130+
PAINTSTRUCT ps;
131+
RECT rect;
132+
133+
switch (message)
134+
{
135+
case WM_PAINT:
136+
{
137+
GetClientRect(hwnd, &rect);
138+
GetWindowText(hwnd, szText, sizeof(szText));
139+
140+
hdc = BeginPaint(hwnd, &ps);
141+
142+
hBrush = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
143+
hBrush = (HBRUSH)SelectObject(hdc, hBrush);
144+
SetBkColor(hdc, GetSysColor(COLOR_WINDOW));
145+
SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT));
146+
Ellipse(hdc, rect.left, rect.top, rect.right, rect.bottom);
147+
DrawText(hdc, szText, -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
148+
DeleteObject(SelectObject(hdc, hBrush));
149+
EndPaint(hwnd, &ps);
150+
return 0;
151+
}
152+
break;
153+
case WM_KEYUP:
154+
{
155+
if (wParam != VK_SPACE)
156+
break;
157+
}
158+
//fall through
159+
case WM_LBUTTONUP:
160+
SendMessage(GetParent(hwnd), WM_COMMAND, GetWindowLong(hwnd, GWL_ID), (LPARAM)hwnd);
161+
return 0;
162+
default:
163+
break;
164+
}
165+
166+
return DefWindowProc(hwnd, message, wParam, lParam);
167+
}

About3/About3.ico

44.4 KB
Binary file not shown.

About3/About3.rc

1.2 KB
Binary file not shown.

About3/About3.vcxproj

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>15.0</VCProjectVersion>
23+
<ProjectGuid>{33629C03-55AC-4CB7-8E07-C8F337940277}</ProjectGuid>
24+
<RootNamespace>About3</RootNamespace>
25+
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
26+
</PropertyGroup>
27+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
28+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
29+
<ConfigurationType>Application</ConfigurationType>
30+
<UseDebugLibraries>true</UseDebugLibraries>
31+
<PlatformToolset>v141</PlatformToolset>
32+
<CharacterSet>MultiByte</CharacterSet>
33+
</PropertyGroup>
34+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
35+
<ConfigurationType>Application</ConfigurationType>
36+
<UseDebugLibraries>false</UseDebugLibraries>
37+
<PlatformToolset>v141</PlatformToolset>
38+
<WholeProgramOptimization>true</WholeProgramOptimization>
39+
<CharacterSet>MultiByte</CharacterSet>
40+
</PropertyGroup>
41+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
42+
<ConfigurationType>Application</ConfigurationType>
43+
<UseDebugLibraries>true</UseDebugLibraries>
44+
<PlatformToolset>v141</PlatformToolset>
45+
<CharacterSet>MultiByte</CharacterSet>
46+
</PropertyGroup>
47+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
48+
<ConfigurationType>Application</ConfigurationType>
49+
<UseDebugLibraries>false</UseDebugLibraries>
50+
<PlatformToolset>v141</PlatformToolset>
51+
<WholeProgramOptimization>true</WholeProgramOptimization>
52+
<CharacterSet>MultiByte</CharacterSet>
53+
</PropertyGroup>
54+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
55+
<ImportGroup Label="ExtensionSettings">
56+
</ImportGroup>
57+
<ImportGroup Label="Shared">
58+
</ImportGroup>
59+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
60+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
61+
</ImportGroup>
62+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
63+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
64+
</ImportGroup>
65+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
66+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
67+
</ImportGroup>
68+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
69+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
70+
</ImportGroup>
71+
<PropertyGroup Label="UserMacros" />
72+
<PropertyGroup />
73+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
74+
<ClCompile>
75+
<WarningLevel>Level3</WarningLevel>
76+
<Optimization>Disabled</Optimization>
77+
<SDLCheck>true</SDLCheck>
78+
<ConformanceMode>true</ConformanceMode>
79+
</ClCompile>
80+
</ItemDefinitionGroup>
81+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
82+
<ClCompile>
83+
<WarningLevel>Level3</WarningLevel>
84+
<Optimization>Disabled</Optimization>
85+
<SDLCheck>true</SDLCheck>
86+
<ConformanceMode>true</ConformanceMode>
87+
</ClCompile>
88+
</ItemDefinitionGroup>
89+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
90+
<ClCompile>
91+
<WarningLevel>Level3</WarningLevel>
92+
<Optimization>MaxSpeed</Optimization>
93+
<FunctionLevelLinking>true</FunctionLevelLinking>
94+
<IntrinsicFunctions>true</IntrinsicFunctions>
95+
<SDLCheck>true</SDLCheck>
96+
<ConformanceMode>true</ConformanceMode>
97+
</ClCompile>
98+
<Link>
99+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
100+
<OptimizeReferences>true</OptimizeReferences>
101+
</Link>
102+
</ItemDefinitionGroup>
103+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
104+
<ClCompile>
105+
<WarningLevel>Level3</WarningLevel>
106+
<Optimization>MaxSpeed</Optimization>
107+
<FunctionLevelLinking>true</FunctionLevelLinking>
108+
<IntrinsicFunctions>true</IntrinsicFunctions>
109+
<SDLCheck>true</SDLCheck>
110+
<ConformanceMode>true</ConformanceMode>
111+
</ClCompile>
112+
<Link>
113+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
114+
<OptimizeReferences>true</OptimizeReferences>
115+
</Link>
116+
</ItemDefinitionGroup>
117+
<ItemGroup>
118+
<ClCompile Include="About3.c" />
119+
</ItemGroup>
120+
<ItemGroup>
121+
<ClInclude Include="resource.h" />
122+
<ClInclude Include="resource1.h" />
123+
</ItemGroup>
124+
<ItemGroup>
125+
<ResourceCompile Include="About3.rc" />
126+
</ItemGroup>
127+
<ItemGroup>
128+
<Image Include="About3.ico" />
129+
</ItemGroup>
130+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
131+
<ImportGroup Label="ExtensionTargets">
132+
</ImportGroup>
133+
</Project>

About3/About3.vcxproj.filters

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Header Files">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Resource Files">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClCompile Include="About3.c">
19+
<Filter>Source Files</Filter>
20+
</ClCompile>
21+
</ItemGroup>
22+
<ItemGroup>
23+
<ClInclude Include="resource.h">
24+
<Filter>Resource Files</Filter>
25+
</ClInclude>
26+
<ClInclude Include="resource1.h">
27+
<Filter>Header Files</Filter>
28+
</ClInclude>
29+
</ItemGroup>
30+
<ItemGroup>
31+
<ResourceCompile Include="About3.rc">
32+
<Filter>Resource Files</Filter>
33+
</ResourceCompile>
34+
</ItemGroup>
35+
<ItemGroup>
36+
<Image Include="About3.ico">
37+
<Filter>Resource Files</Filter>
38+
</Image>
39+
</ItemGroup>
40+
</Project>

About3/resource.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
#define IDM_APP_ABOUT 40001
3+
#define IDC_STATIC -1

About3/resource1.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//{{NO_DEPENDENCIES}}
2+
// Microsoft Visual C++ generated include file.
3+
// Used by About3.rc
4+
5+
// Next default values for new objects
6+
//
7+
#ifdef APSTUDIO_INVOKED
8+
#ifndef APSTUDIO_READONLY_SYMBOLS
9+
#define _APS_NEXT_RESOURCE_VALUE 101
10+
#define _APS_NEXT_COMMAND_VALUE 40001
11+
#define _APS_NEXT_CONTROL_VALUE 1001
12+
#define _APS_NEXT_SYMED_VALUE 101
13+
#endif
14+
#endif

About3/x64/Debug/About3.res

45.2 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17134.0
2+
Debug|x64|C:\Users\sahils\Documents\Visual Studio 2017\Projects\GokhaleSirClassPuneWin32DotNetComWinrt\|
862 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)