From a0437093fbb301af5f310fc24dead24dc785cde7 Mon Sep 17 00:00:00 2001 From: Grayson Riffe Date: Wed, 30 Aug 2023 14:50:34 -0500 Subject: [PATCH] Add main dialog --- .gitignore | 1 + WinChat/WinChat.rc | Bin 0 -> 4654 bytes WinChat/WinChat.vcxproj | 4 ++++ WinChat/WinChat.vcxproj.filters | 8 ++++++++ WinChat/resource.h | 17 +++++++++++++++++ WinChat/src/Application.cpp | 21 +++++++++++++++++++++ WinChat/src/Application.h | 6 ++++++ WinChat/src/main.cpp | 2 +- 8 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 WinChat/WinChat.rc create mode 100644 WinChat/resource.h diff --git a/.gitignore b/.gitignore index 4adf81b..47c6b89 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .vs/ build/ version.h +*.aps \ No newline at end of file diff --git a/WinChat/WinChat.rc b/WinChat/WinChat.rc new file mode 100644 index 0000000000000000000000000000000000000000..d9cec9efb45b8f76eca4969822c992e17941f096 GIT binary patch literal 4654 zcmd^@T~8W86o$`rlm3V8dQ(%PB3kv5?-Butpw+~L7%43Y#YQykMSpwS=bdrN0t;5# z3rw>aX7*obxm z{g%E5?S@|a?igJ$j(8Kdfqh}khP|{GNZEA#8q^W9Lss|P+IVjNhJCWwt=7&px32H@ ziFe*w*0zqFSjlR3WL-P9GSm{|rq%5nN}Jz?6`<4^2l>)r^`4+z=p(D*msub8@zS+@ z#{OHpBR_Po`i$QiRu{2T{wPD=rp-p=;TU{%{`LE&{l9u13mSQJ+~F%BsgK=H!$$CY z;JaFV&@LjnBl2%Zq{d(%ve(3X#9PS2HY1;vV_Q!_!8nmq1Lv<-Q@PcHW8NyD%I8#@ z{5c`Jib(E)t~!tSe&>l6?(D$h7z}sW)nxy=lUj$`gnB|>bvO+azpe`J8oBz;GVpG* zt^mdFnO)Ik)@QXxfNWWe0OiLimK-9r^z3RudX@)Fs8`G4v-Fjbn=fE{)l~|uj_#lI z%6nm3_tjVN^B&VK)s?5nNUQj<&DWdQE~r}fqT!|p1pOvb(WvAUuRc|yw>SmhE{=NlV0^E%ru~toU{rxCXWuYbwX%R_9UiZ{kQp;Rbi5TOjWh5& zFlm#uU7ie060^vboPcQgCY`5W5o7-)*{K`e@V5l{ME8#}5zJ5{c4-eus-v;Ly9C+O zee7b=g0GLTJSA(24jVdO6tAND?KtE};+ExDx8p3#IW6{`ebZG;7ALX4TH~Ny=!N?- zQK^wzO@5m$E5fXLHC5Qhoq#%rL7; + + + + diff --git a/WinChat/WinChat.vcxproj.filters b/WinChat/WinChat.vcxproj.filters index a9b5430..065fd8b 100644 --- a/WinChat/WinChat.vcxproj.filters +++ b/WinChat/WinChat.vcxproj.filters @@ -26,5 +26,13 @@ Header Files + + Header Files + + + + + Resource Files + \ No newline at end of file diff --git a/WinChat/resource.h b/WinChat/resource.h new file mode 100644 index 0000000..11c7b92 --- /dev/null +++ b/WinChat/resource.h @@ -0,0 +1,17 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by WinChat.rc +// +#define IDD_MAINDIALOG 101 +#define IDC_STATICTITLE 1001 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1002 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/WinChat/src/Application.cpp b/WinChat/src/Application.cpp index 4f2ebb3..839c019 100644 --- a/WinChat/src/Application.cpp +++ b/WinChat/src/Application.cpp @@ -1,5 +1,7 @@ #include "Application.h" +#include "../resource.h" + namespace wc { Application::Application(std::string& appName, std::string& appVersion) : m_appName(appName) @@ -8,6 +10,25 @@ namespace wc { std::printf("%s %s\n", m_appName.c_str(), m_appVersion.c_str()); } + void Application::run() { + HINSTANCE hInst = GetModuleHandle(NULL); + DialogBox(hInst, MAKEINTRESOURCE(IDD_MAINDIALOG), nullptr, (DLGPROC)dlgProc); + } + + BOOL CALLBACK Application::dlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { + switch (msg) { + case WM_INITDIALOG: + + return TRUE; + + case WM_CLOSE: + EndDialog(hWnd, 0); + return TRUE; + } + + return FALSE; + } + Application::~Application() { } diff --git a/WinChat/src/Application.h b/WinChat/src/Application.h index e972a82..e356928 100644 --- a/WinChat/src/Application.h +++ b/WinChat/src/Application.h @@ -1,13 +1,19 @@ #pragma once #include +#include + namespace wc { class Application { public: Application(std::string& appName, std::string& appVersion); + void run(); + ~Application(); private: + static BOOL CALLBACK dlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); + const std::string m_appName; const std::string m_appVersion; }; diff --git a/WinChat/src/main.cpp b/WinChat/src/main.cpp index 1827304..a5c8f3b 100644 --- a/WinChat/src/main.cpp +++ b/WinChat/src/main.cpp @@ -11,8 +11,8 @@ int main(int argc, char* argv[]) { { wc::Application app(appName, appVer); + app.run(); } - std::cin.get(); return EXIT_SUCCESS; } \ No newline at end of file