stuff-from-scratch/apps/notes_tk/main-win.cpp
2023-01-05 13:16:52 +00:00

47 lines
1.1 KiB
C++

#ifndef UNICODE
#define UNICODE
#endif
#include "MainApplication.h"
#include "NotesTk.h"
#include "CommandLineArgs.h"
#include "Win32WindowInterface.h"
#include "FileLogger.h"
#include "StringUtils.h"
#include "Widget.h"
#include "windows.h"
#include <iostream>
#include <vector>
#include <string>
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
{
std::ofstream out("out.txt");
std::cout.rdbuf(out.rdbuf());
auto args = CommandLineArgs::Create();
CommandLineArgs::initialize(args.get());
args->recordLaunchPath();
// Start the main app
auto main_app = MainApplication::Create();
auto applicationContext = std::make_unique<Win32ApplicationContext>();
applicationContext->hInstance = reinterpret_cast<void*>(hInstance);
applicationContext->nCmdShow = nCmdShow;
main_app->initialize(std::move(args), std::move(applicationContext));
MLOG_INFO("Creating GUI Application");
// Start the gui application
auto gui_app = NotesTk(nullptr, std::move(main_app));
MLOG_INFO("Running GUI Application");
gui_app.run();
return 0;
}