stuff-from-scratch/apps/notes_tk/main-win.cpp

48 lines
1.1 KiB
C++
Raw Normal View History

2020-07-04 18:43:08 +00:00
#ifndef UNICODE
#define UNICODE
#endif
2021-10-31 13:04:48 +00:00
#include "MainApplication.h"
2023-01-03 20:33:18 +00:00
#include "NotesTk.h"
2021-10-31 13:04:48 +00:00
#include "CommandLineArgs.h"
#include "Win32WindowInterface.h"
#include "FileLogger.h"
#include "StringUtils.h"
2023-01-03 20:33:18 +00:00
#include "Widget.h"
2021-10-31 13:04:48 +00:00
2020-07-04 18:43:08 +00:00
#include "windows.h"
2021-10-31 13:04:48 +00:00
#include <iostream>
#include <vector>
#include <string>
2020-07-04 18:43:08 +00:00
2021-10-31 13:04:48 +00:00
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
2020-07-04 18:43:08 +00:00
{
2021-10-31 13:04:48 +00:00
std::ofstream out("out.txt");
std::cout.rdbuf(out.rdbuf());
2022-11-30 20:53:17 +00:00
auto args = CommandLineArgs::Create();
2023-01-05 13:16:52 +00:00
CommandLineArgs::initialize(args.get());
2022-11-30 20:53:17 +00:00
args->recordLaunchPath();
2021-10-31 13:04:48 +00:00
// Start the main app
auto main_app = MainApplication::Create();
2020-07-04 18:43:08 +00:00
2021-10-31 13:04:48 +00:00
auto applicationContext = std::make_unique<Win32ApplicationContext>();
applicationContext->hInstance = reinterpret_cast<void*>(hInstance);
applicationContext->nCmdShow = nCmdShow;
2020-07-04 18:43:08 +00:00
2022-11-30 20:53:17 +00:00
main_app->initialize(std::move(args), std::move(applicationContext));
2020-07-04 18:43:08 +00:00
2021-10-31 13:04:48 +00:00
MLOG_INFO("Creating GUI Application");
// Start the gui application
2023-01-03 20:33:18 +00:00
auto gui_app = NotesTk(nullptr, std::move(main_app));
2021-10-31 13:04:48 +00:00
MLOG_INFO("Running GUI Application");
2022-11-30 20:53:17 +00:00
gui_app.run();
2021-10-31 13:04:48 +00:00
return 0;
}
2020-07-04 18:43:08 +00:00