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 0000000..d9cec9e Binary files /dev/null and b/WinChat/WinChat.rc differ diff --git a/WinChat/WinChat.vcxproj b/WinChat/WinChat.vcxproj index be5b87e..c10d3f6 100644 --- a/WinChat/WinChat.vcxproj +++ b/WinChat/WinChat.vcxproj @@ -94,8 +94,12 @@ + + + + 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