Add main dialog
This commit is contained in:
parent
ba68c396d2
commit
a0437093fb
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
.vs/
|
.vs/
|
||||||
build/
|
build/
|
||||||
version.h
|
version.h
|
||||||
|
*.aps
|
BIN
WinChat/WinChat.rc
Normal file
BIN
WinChat/WinChat.rc
Normal file
Binary file not shown.
@ -94,8 +94,12 @@
|
|||||||
<ClCompile Include="src\main.cpp" />
|
<ClCompile Include="src\main.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="resource.h" />
|
||||||
<ClInclude Include="src\Application.h" />
|
<ClInclude Include="src\Application.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="WinChat.rc" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
@ -26,5 +26,13 @@
|
|||||||
<ClInclude Include="src\Application.h">
|
<ClInclude Include="src\Application.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="resource.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="WinChat.rc">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
17
WinChat/resource.h
Normal file
17
WinChat/resource.h
Normal file
@ -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
|
@ -1,5 +1,7 @@
|
|||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
|
#include "../resource.h"
|
||||||
|
|
||||||
namespace wc {
|
namespace wc {
|
||||||
Application::Application(std::string& appName, std::string& appVersion)
|
Application::Application(std::string& appName, std::string& appVersion)
|
||||||
: m_appName(appName)
|
: m_appName(appName)
|
||||||
@ -8,6 +10,25 @@ namespace wc {
|
|||||||
std::printf("%s %s\n", m_appName.c_str(), m_appVersion.c_str());
|
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() {
|
Application::~Application() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,19 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <Windows.h>
|
||||||
|
|
||||||
namespace wc {
|
namespace wc {
|
||||||
class Application {
|
class Application {
|
||||||
public:
|
public:
|
||||||
Application(std::string& appName, std::string& appVersion);
|
Application(std::string& appName, std::string& appVersion);
|
||||||
|
|
||||||
|
void run();
|
||||||
|
|
||||||
~Application();
|
~Application();
|
||||||
private:
|
private:
|
||||||
|
static BOOL CALLBACK dlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
const std::string m_appName;
|
const std::string m_appName;
|
||||||
const std::string m_appVersion;
|
const std::string m_appVersion;
|
||||||
};
|
};
|
||||||
|
@ -11,8 +11,8 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
{
|
{
|
||||||
wc::Application app(appName, appVer);
|
wc::Application app(appName, appVer);
|
||||||
|
app.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cin.get();
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user