Explorar o código

添加项目文件。

XKSYU2021 hai 2 semanas
pai
achega
b66583b2d4

+ 31 - 0
XksyuCalculator.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.14.36408.4 d17.14
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XksyuCalculator", "XksyuCalculator\XksyuCalculator.vcxproj", "{1BF3A51C-6D45-45AF-B694-6655F45BD571}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{1BF3A51C-6D45-45AF-B694-6655F45BD571}.Debug|x64.ActiveCfg = Debug|x64
+		{1BF3A51C-6D45-45AF-B694-6655F45BD571}.Debug|x64.Build.0 = Debug|x64
+		{1BF3A51C-6D45-45AF-B694-6655F45BD571}.Debug|x86.ActiveCfg = Debug|Win32
+		{1BF3A51C-6D45-45AF-B694-6655F45BD571}.Debug|x86.Build.0 = Debug|Win32
+		{1BF3A51C-6D45-45AF-B694-6655F45BD571}.Release|x64.ActiveCfg = Release|x64
+		{1BF3A51C-6D45-45AF-B694-6655F45BD571}.Release|x64.Build.0 = Release|x64
+		{1BF3A51C-6D45-45AF-B694-6655F45BD571}.Release|x86.ActiveCfg = Release|Win32
+		{1BF3A51C-6D45-45AF-B694-6655F45BD571}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {CCC6AB59-70F5-4167-B03E-AB53E0AE2317}
+	EndGlobalSection
+EndGlobal

+ 19 - 0
XksyuCalculator/ID.h

@@ -0,0 +1,19 @@
+#pragma once
+
+constexpr auto ID_PUT_MAIN = 1001;
+constexpr auto ID_PUT_LITE = 1002;
+
+#define NUM(x) 2000+x;
+
+constexpr auto ID_OP_C = 3001;
+constexpr auto ID_OP_DEL = 3002;
+
+constexpr auto ID_OP_D = 3003;
+constexpr auto ID_OP_T = 3004;
+constexpr auto ID_OP_M = 3005;
+constexpr auto ID_OP_P = 3006;
+
+constexpr auto ID_OP_EQ = 3007;
+
+constexpr auto ID_OP_POINT = 3008;
+constexpr auto ID_OP_POW = 3009;

+ 48 - 0
XksyuCalculator/MAIN.cpp

@@ -0,0 +1,48 @@
+#include "lib.h"
+
+LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+HWND hWndMain;
+
+int WINAPI WinMain(_In_ HINSTANCE hInstance,
+    _In_opt_ HINSTANCE hPrevInstance,
+    _In_ LPSTR     lpCmdLine,
+    _In_ int       nCmdShow)
+{
+
+    const wchar_t CLASS_NAME[] = L"EmptyProc";
+
+    WNDCLASSEX wcex = {};
+    wcex.cbSize = sizeof(WNDCLASSEX);
+    wcex.style = CS_HREDRAW | CS_VREDRAW; //WndRePaint
+    wcex.lpfnWndProc = WndProc;
+    wcex.cbClsExtra = 0;
+    wcex.cbWndExtra = 0;
+    wcex.hInstance = hInstance;
+    wcex.hIcon = LoadIcon(wcex.hInstance, IDI_APPLICATION);
+    wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
+    wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
+    wcex.lpszMenuName = NULL;
+    wcex.lpszClassName = CLASS_NAME;
+    wcex.hIconSm = LoadIcon(wcex.hInstance, IDI_APPLICATION);
+    RegisterClassEx(&wcex);
+
+    hWndMain = CreateWindowEx(
+        NULL,
+        CLASS_NAME, TITLE,
+        WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
+        CW_USEDEFAULT, CW_USEDEFAULT, //position
+        500, 700, //square
+        NULL, NULL, hInstance, NULL);
+
+    ShowWindow(hWndMain, nCmdShow);
+    UpdateWindow(hWndMain);
+
+    MSG msg = { };
+    while (GetMessage(&msg, NULL, 0, 0) > 0)
+    {
+        TranslateMessage(&msg);
+        DispatchMessage(&msg);
+    }
+
+    return 0;
+}

+ 144 - 0
XksyuCalculator/XksyuCalculator.vcxproj

@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>17.0</VCProjectVersion>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectGuid>{1bf3a51c-6d45-45af-b694-6655f45bd571}</ProjectGuid>
+    <RootNamespace>XksyuCalculator</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+    <Manifest>
+      <EnableDpiAwareness>true</EnableDpiAwareness>
+    </Manifest>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+    <Manifest>
+      <EnableDpiAwareness>true</EnableDpiAwareness>
+    </Manifest>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClInclude Include="ID.h" />
+    <ClInclude Include="shareValue.h" />
+    <ClInclude Include="lib.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="cal.cpp" />
+    <ClCompile Include="MAIN.cpp" />
+    <ClCompile Include="mainProc.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 39 - 0
XksyuCalculator/XksyuCalculator.vcxproj.filters

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="源文件">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="头文件">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="资源文件">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="lib.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="ID.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="shareValue.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="MAIN.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="mainProc.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="cal.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>

+ 175 - 0
XksyuCalculator/cal.cpp

@@ -0,0 +1,175 @@
+#include "lib.h"
+#include <math.h>
+
+INT store = 0, read = 0; WCHAR op; BOOL once_op = FALSE, once_op_temp = FALSE;
+extern HWND hPutMain, hPutLite;
+BOOL divZero = FALSE;
+
+static INT cal(INT a, INT b, WCHAR op)
+{
+	switch (op)
+	{
+	case '+':
+		return a + b;
+	case '-':
+		return a - b;
+	case '*':
+		return a * b;
+	case '/':
+		if (b == 0)
+		{
+			divZero = TRUE;
+			return 0;
+		}
+		return a / b;
+	case '^':
+		return pow(a, b);
+	}
+}
+
+static VOID update_cal()
+{
+	if (once_op_temp || !once_op)
+	{
+		std::wstring str = std::to_wstring(read);
+		LPCWSTR output = str.c_str();
+		SendMessage(hPutLite, WM_SETTEXT, FALSE, (LPARAM)output);
+	}
+	else
+	{
+		std::wstring str = std::to_wstring(cal(store, read, op));
+		LPCWSTR output = str.c_str();
+		SendMessage(hPutLite, WM_SETTEXT, FALSE, (LPARAM)output);
+	}
+}
+
+VOID clear()
+{
+	store = 0; read = 0;
+	once_op = FALSE; once_op_temp = FALSE;
+	LPCWSTR output = L"0";
+	SendMessage(hPutMain, WM_SETTEXT, FALSE, (LPARAM)output);
+	SendMessage(hPutLite, WM_SETTEXT, FALSE, (LPARAM)output);
+	divZero = FALSE;
+}
+
+VOID update_equal()
+{
+	if (divZero)
+	{
+		MessageBox(
+			hWndMain, L"cannot divide zero",
+			MB_OK, NULL
+		);
+		clear();
+		return;
+	}
+	update_cal();
+	read = cal(store, read, op);
+	std::wstring str = std::to_wstring(read);
+	LPCWSTR output = str.c_str();
+	SendMessage(hPutMain, WM_SETTEXT, FALSE, (LPARAM)output);
+	once_op = FALSE;
+	once_op_temp = FALSE;
+}
+
+static BOOL update_equal_fromOP()
+{
+	if (divZero)
+	{
+		MessageBox(
+			hWndMain, L"cannot divide zero",
+			MB_OK, NULL
+		);
+		clear();
+		return FALSE;
+	}
+	update_cal();
+	store = cal(store, read, op);
+	std::wstring str = std::to_wstring(store);
+	LPCWSTR output = str.c_str();
+	SendMessage(hPutMain, WM_SETTEXT, FALSE, (LPARAM)output);
+	read = 0;
+	return TRUE;
+}
+
+static BOOL update_input(LPCWSTR x)
+{
+	INT length = GetWindowTextLength(hPutMain);
+	LPWSTR buffer = (LPWSTR)malloc((length + 1) * sizeof(WCHAR));
+	SendMessage(hPutMain, WM_GETTEXT, 100, (LPARAM)buffer);
+
+	BOOL is_op = !(x[0] != '+' && x[0] != '-' && x[0] != '*' && x[0] != '/' && x[0] != '^');
+
+	if (is_op)
+	{
+		if (!once_op)
+		{
+			store = read;
+			read = 0;
+		}
+		else if (once_op_temp)
+			return FALSE;
+		else
+			if (!update_equal_fromOP())
+				return FALSE;
+		op = x[0];
+		once_op = TRUE;
+		once_op_temp = TRUE;
+	}
+	else
+	{
+		read = read * 10 + _wtoi(x);
+		once_op_temp = FALSE;
+	}
+
+	length = GetWindowTextLength(hPutMain);
+	if(buffer != NULL && length == 1 && buffer[0] == L'0' && !is_op)
+		SendMessage(hPutMain, WM_SETTEXT, FALSE, (LPARAM)x);
+	else
+	{
+		SendMessage(hPutMain, EM_SETSEL, length, length);
+		SendMessage(hPutMain, EM_REPLACESEL, FALSE, (LPARAM)x);
+	}
+	return TRUE;
+}
+
+VOID update(LPCWSTR x)
+{
+	divZero = FALSE;
+	if(update_input(x))
+		update_cal();
+	if (read >= INT_MAX || read <= INT_MIN || store >= INT_MAX || store <= INT_MIN)
+	{
+		MessageBox(
+			hWndMain, L"overflow!",
+			MB_OK, NULL
+		);
+		clear();
+	}
+}
+
+
+
+VOID del()
+{
+	if (read == 0&& !once_op_temp)
+		return;
+
+	INT length = GetWindowTextLength(hPutMain);
+	SendMessage(hPutMain, EM_SETSEL, length-1, length);
+	SendMessage(hPutMain, EM_REPLACESEL, FALSE, NULL);
+
+	LPWSTR buffer = (LPWSTR)malloc((length + 1) * sizeof(WCHAR));
+	SendMessage(hPutMain, WM_GETTEXT, 100, (LPARAM)buffer);
+
+	if (once_op_temp)
+	{
+		read = store;
+		once_op = FALSE;
+		once_op_temp = FALSE;
+	}
+	else
+		read /= 10;
+	update_cal();
+}

+ 26 - 0
XksyuCalculator/lib.h

@@ -0,0 +1,26 @@
+#pragma once
+
+#ifndef UNICODE
+#define UNICODE
+#endif 
+
+#ifdef _UNICODE
+#if defined _M_IX86
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+#endif
+
+//Outside
+#include <Windows.h>
+
+#include <tchar.h>
+#include <string>
+#include <fstream>
+
+//Inner
+#include "shareValue.h"
+#include "ID.h"

+ 211 - 0
XksyuCalculator/mainProc.cpp

@@ -0,0 +1,211 @@
+#include "lib.h"
+
+VOID clear();
+VOID update(LPCWSTR x);
+VOID update_equal();
+VOID del();
+
+HWND hPutMain, hPutLite, hNumberButton[9], hSymbolButton[9], hEqualButton;
+
+const INT posi_y[5] = {190,275,360,445,530}, posi_x[4] = {15,130,245,360};
+
+constexpr static INT getNumID(INT x)
+{
+    return 2000 + x;
+}
+
+static VOID conInit_main_NumberButton(HWND hwnd, INT i, INT x, INT y, LPCWSTR text, HFONT hFont)
+{
+    INT id = 2000 + i;
+    hNumberButton[i] = CreateWindow(
+        L"BUTTON", text,
+        WS_VISIBLE | WS_CHILD,
+        x, y, 100, 70,
+        hwnd,
+        (HMENU)id, (HINSTANCE)GetWindowLongPtr(hPutLite, GWLP_HINSTANCE), NULL
+    );
+    SendMessage(hNumberButton[i], WM_SETFONT, (WPARAM)hFont, TRUE);
+}
+
+static VOID conInit_main_SymbolButton(HWND hwnd, INT i, INT x, INT y, LPCWSTR text, HFONT hFont)
+{
+    INT id = 3000 + i;
+    hSymbolButton[i] = CreateWindow(
+        L"BUTTON", text,
+        WS_VISIBLE | WS_CHILD,
+        x, y, 100, 70,
+        hwnd,
+        (HMENU)id, (HINSTANCE)GetWindowLongPtr(hPutLite, GWLP_HINSTANCE), NULL
+    );
+    SendMessage(hSymbolButton[i], WM_SETFONT, (WPARAM)hFont, TRUE);
+}
+
+static VOID conInit_main(HWND hwnd)
+{
+    HFONT hFontLarge = CreateFont(
+        -65, 0, 0, 0,
+        FW_BOLD, FALSE, FALSE, FALSE,
+        DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
+        ANTIALIASED_QUALITY, FF_MODERN,
+        L"΢ÈíÑźÚ"
+    );
+    HFONT hFont = CreateFont(
+        -40, 0, 0, 0,
+        FALSE, FALSE, FALSE, FALSE,
+        DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
+        ANTIALIASED_QUALITY, FF_MODERN,
+        L"΢ÈíÑźÚ"
+    );
+    HFONT hFontLite = CreateFont(
+        -35, 0, 0, 0,
+        FALSE, FALSE, FALSE, FALSE,
+        DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
+        ANTIALIASED_QUALITY, FF_MODERN,
+        L"΢ÈíÑźÚ"
+    );
+
+
+    hPutMain = CreateWindow(
+        L"EDIT", _T("0"),
+        WS_VISIBLE | WS_CHILD | WS_BORDER | ES_RIGHT | ES_READONLY,
+        15, 15, 445, 100,
+        hwnd,
+        (HMENU)ID_PUT_MAIN, (HINSTANCE)GetWindowLongPtr(hPutMain, GWLP_HINSTANCE), NULL
+    );
+    SendMessage(hPutMain, WM_SETFONT, (WPARAM)hFontLarge, TRUE);
+
+    hPutLite = CreateWindow(
+        L"EDIT", _T("0"),
+        WS_VISIBLE | WS_CHILD | WS_BORDER | ES_RIGHT | ES_READONLY,
+        15, 115, 445, 50,
+        hwnd,
+        (HMENU)ID_PUT_LITE, (HINSTANCE)GetWindowLongPtr(hPutLite, GWLP_HINSTANCE), NULL
+    );
+    SendMessage(hPutLite, WM_SETFONT, (WPARAM)hFontLite, TRUE);
+
+    //200x
+    conInit_main_NumberButton(hwnd, 7, posi_x[0], posi_y[1], _T("7"), hFont);
+    conInit_main_NumberButton(hwnd, 8, posi_x[1], posi_y[1], _T("8"), hFont);
+    conInit_main_NumberButton(hwnd, 9, posi_x[2], posi_y[1], _T("9"), hFont);
+    conInit_main_NumberButton(hwnd, 4, posi_x[0], posi_y[2], _T("4"), hFont);
+    conInit_main_NumberButton(hwnd, 5, posi_x[1], posi_y[2], _T("5"), hFont);
+    conInit_main_NumberButton(hwnd, 6, posi_x[2], posi_y[2], _T("6"), hFont);
+    conInit_main_NumberButton(hwnd, 1, posi_x[0], posi_y[3], _T("1"), hFont);
+    conInit_main_NumberButton(hwnd, 2, posi_x[1], posi_y[3], _T("2"), hFont);
+    conInit_main_NumberButton(hwnd, 3, posi_x[2], posi_y[3], _T("3"), hFont);
+    conInit_main_NumberButton(hwnd, 0, posi_x[1], posi_y[4], _T("0"), hFont);
+    
+    //300x
+    conInit_main_SymbolButton(hwnd, 1, posi_x[1], posi_y[0], _T("C"), hFont);
+    conInit_main_SymbolButton(hwnd, 2, posi_x[2], posi_y[0], _T("Del"), hFont);
+    conInit_main_SymbolButton(hwnd, 3, posi_x[3], posi_y[0], _T("/"), hFont);
+    conInit_main_SymbolButton(hwnd, 4, posi_x[3], posi_y[1], _T("*"), hFont);
+    conInit_main_SymbolButton(hwnd, 5, posi_x[3], posi_y[2], _T("-"), hFont);
+    conInit_main_SymbolButton(hwnd, 6, posi_x[3], posi_y[3], _T("+"), hFont);
+
+    hEqualButton = CreateWindow(
+        L"BUTTON", L"=",
+        WS_VISIBLE | WS_CHILD,
+        posi_x[2], posi_y[4], 220, 70,
+        hwnd,
+        (HMENU)ID_OP_EQ, (HINSTANCE)GetWindowLongPtr(hPutLite, GWLP_HINSTANCE), NULL
+    );
+    SendMessage(hEqualButton, WM_SETFONT, (WPARAM)hFont, TRUE);
+
+    conInit_main_SymbolButton(hwnd, 8, posi_x[0], posi_y[4], _T("."), hFont);
+    conInit_main_SymbolButton(hwnd, 9, posi_x[0], posi_y[0], _T("^"), hFont);
+}
+
+LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    switch (uMsg)
+    {
+    case WM_CREATE:
+    {
+        conInit_main(hwnd);
+        break;
+    }
+    case WM_PAINT:
+    {
+        PAINTSTRUCT ps;
+        HDC hdc = BeginPaint(hwnd, &ps);
+        FillRect(hdc, &ps.rcPaint, (HBRUSH)(COLOR_WINDOW + 1));
+        EndPaint(hwnd, &ps);
+        break;
+    }
+
+    case WM_COMMAND:
+    {
+        WORD wmId = LOWORD(wParam);
+        switch (wmId)
+        {
+        case getNumID(1):
+            update(L"1");
+            break;
+        case getNumID(2):
+            update(L"2");
+            break;
+        case getNumID(3):
+            update(L"3");
+            break;
+        case getNumID(4):
+            update(L"4");
+            break;
+        case getNumID(5):
+            update(L"5");
+            break;
+        case getNumID(6):
+            update(L"6");
+            break;
+        case getNumID(7):
+            update(L"7");
+            break;
+        case getNumID(8):
+            update(L"8");
+            break;
+        case getNumID(9):
+            update(L"9");
+            break;
+        case getNumID(0):
+            update(L"0");
+            break;
+        case ID_OP_D:
+            update(L"/");
+            break;
+        case ID_OP_T:
+            update(L"*");
+            break;
+        case ID_OP_M:
+            update(L"-");
+            break;
+        case ID_OP_P:
+            update(L"+");
+            break;
+        case ID_OP_POW:
+            update(L"^");
+            break;
+        case ID_OP_EQ:
+            update_equal();
+            break;
+        case ID_OP_C:
+            clear();
+            break;
+        case ID_OP_DEL:
+            del();
+            break;
+        default:
+            break;
+        }
+        break;
+    }
+
+    case WM_DESTROY:
+        PostQuitMessage(0);
+        return 0;
+
+    default:
+        break;
+
+    }
+    return DefWindowProc(hwnd, uMsg, wParam, lParam);
+}

+ 4 - 0
XksyuCalculator/shareValue.h

@@ -0,0 +1,4 @@
+#pragma once
+
+#define TITLE _T("Calculator")
+extern HWND hWndMain;