Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0182246

Browse files
author
U-NVIDIA.COM\sahils
committed
added back gitignore
1 parent 83919ce commit 0182246

File tree

267 files changed

+716
-81
lines changed

Some content is hidden

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

267 files changed

+716
-81
lines changed

‎.gitattributes‎

Lines changed: 0 additions & 68 deletions
This file was deleted.

‎5.Hexcalc/5.Hexcalc.vcxproj‎

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
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>{CBE411B1-1378-454A-B7A3-02A97ABE2A37}</ProjectGuid>
24+
<RootNamespace>My5Hexcalc</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="hexcalc.c" />
119+
</ItemGroup>
120+
<ItemGroup>
121+
<ClInclude Include="resource.h" />
122+
</ItemGroup>
123+
<ItemGroup>
124+
<ResourceCompile Include="hexcalc.rc" />
125+
</ItemGroup>
126+
<ItemGroup>
127+
<Image Include="hexcalc.ico" />
128+
</ItemGroup>
129+
<ItemGroup>
130+
<None Include="hexcalc.dlg" />
131+
</ItemGroup>
132+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
133+
<ImportGroup Label="ExtensionTargets">
134+
</ImportGroup>
135+
</Project>

‎5.Hexcalc/5.Hexcalc.vcxproj.filters‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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="hexcalc.c">
19+
<Filter>Source Files</Filter>
20+
</ClCompile>
21+
</ItemGroup>
22+
<ItemGroup>
23+
<ClInclude Include="resource.h">
24+
<Filter>Header Files</Filter>
25+
</ClInclude>
26+
</ItemGroup>
27+
<ItemGroup>
28+
<ResourceCompile Include="hexcalc.rc">
29+
<Filter>Resource Files</Filter>
30+
</ResourceCompile>
31+
</ItemGroup>
32+
<ItemGroup>
33+
<Image Include="hexcalc.ico">
34+
<Filter>Resource Files</Filter>
35+
</Image>
36+
</ItemGroup>
37+
<ItemGroup>
38+
<None Include="hexcalc.dlg">
39+
<Filter>Resource Files</Filter>
40+
</None>
41+
</ItemGroup>
42+
</Project>

‎5.Hexcalc/hexcalc.c‎

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
#include <Windows.h>
2+
3+
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
4+
5+
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
6+
{
7+
static TCHAR szAppName[] = TEXT("HexCalc");
8+
HWND hwnd;
9+
MSG msg;
10+
WNDCLASS wndclass;
11+
12+
wndclass.style = CS_HREDRAW | CS_VREDRAW;
13+
wndclass.lpfnWndProc = WndProc;
14+
wndclass.cbClsExtra = 0;
15+
wndclass.cbWndExtra = DLGWINDOWEXTRA;
16+
wndclass.hInstance = hInstance;
17+
wndclass.hIcon = LoadIcon(hInstance, szAppName);
18+
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
19+
wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
20+
wndclass.lpszMenuName = NULL;
21+
wndclass.lpszClassName = szAppName;
22+
23+
if (!RegisterClass(&wndclass))
24+
{
25+
MessageBox(NULL, TEXT("RegisterClass() error"), szAppName, MB_ICONERROR);
26+
return 0;
27+
}
28+
29+
hwnd = CreateDialog(hInstance, szAppName, 0, NULL);
30+
31+
ShowWindow(hwnd, iCmdShow);
32+
33+
while (GetMessage(&msg, NULL, 0, 0))
34+
{
35+
TranslateMessage(&msg);
36+
DispatchMessage(&msg);
37+
}
38+
39+
return (int)msg.wParam;
40+
}
41+
42+
void ShowNumber(HWND hwnd, UINT iNumber)
43+
{
44+
TCHAR szBuffer[20];
45+
wsprintf(szBuffer, TEXT("%X"), iNumber);
46+
SetDlgItemText(hwnd, VK_ESCAPE, szBuffer);
47+
}
48+
49+
DWORD CalcIt(UINT iFirstNum, int iOperation, UINT iNum)
50+
{
51+
switch (iOperation)
52+
{
53+
case '=': return iNum;
54+
case '+': return iFirstNum + iNum;
55+
case '-': return iFirstNum - iNum;
56+
case '*': return iFirstNum * iNum;
57+
case '&': return iFirstNum & iNum;
58+
case '|': return iFirstNum | iNum;
59+
case '^': return iFirstNum ^ iNum;
60+
case '<': return iFirstNum << iNum;
61+
case '>': return iFirstNum >> iNum;
62+
case '/': return iNum ? iFirstNum / iNum : MAXDWORD;
63+
case '%': return iNum ? iFirstNum % iNum : MAXDWORD;
64+
default: return 0;
65+
}
66+
}
67+
68+
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
69+
{
70+
static BOOL bNewNumber = TRUE;
71+
static int iOperation = '=';
72+
static UINT iNumber, iFirstNum;
73+
HWND hButton;
74+
75+
switch (message)
76+
{
77+
case WM_KEYDOWN:
78+
if (wParam != VK_LEFT)
79+
break;
80+
wParam = VK_BACK;
81+
//fallthrouh
82+
case WM_CHAR:
83+
if ((wParam = (WPARAM)CharUpper((TCHAR*)wParam)) == VK_RETURN)
84+
wParam = '=';
85+
if (hButton = GetDlgItem(hwnd, wParam))
86+
{
87+
SendMessage(hButton, BM_SETSTATE, 1, 0);
88+
Sleep(100);
89+
SendMessage(hButton, BM_SETSTATE, 0, 0);
90+
}
91+
else
92+
{
93+
MessageBeep(0);
94+
break;
95+
}
96+
//fallthrough
97+
case WM_COMMAND:
98+
SetFocus(hwnd);
99+
if (LOWORD(wParam) == VK_BACK) //backspace
100+
ShowNumber(hwnd, iNumber /= 16);
101+
else if (LOWORD(wParam) == VK_ESCAPE) //escape
102+
ShowNumber(hwnd, iNumber = 0);
103+
else if (isxdigit(LOWORD(wParam))) //hex digit
104+
{
105+
if(bNewNumber)
106+
{
107+
iFirstNum = iNumber;
108+
iNumber = 0;
109+
}
110+
bNewNumber = FALSE;
111+
112+
if (iNumber <= MAXDWORD >> 4)
113+
ShowNumber(hwnd, iNumber = 16 * iNumber + wParam - (isdigit(wParam) ? '0' : 'A' - 10));
114+
else
115+
MessageBeep(0);
116+
}
117+
else
118+
{
119+
if (!bNewNumber)
120+
ShowNumber(hwnd, iNumber = CalcIt(iFirstNum, iOperation, iNumber));
121+
bNewNumber = TRUE;
122+
iOperation = LOWORD(wParam);
123+
}
124+
return 0;
125+
case WM_DESTROY:
126+
PostQuitMessage(0);
127+
return 0;
128+
default:
129+
break;
130+
}
131+
return DefWindowProc(hwnd, message, wParam, lParam);
132+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /