-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cc
34 lines (27 loc) · 829 Bytes
/
main.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "webview.h"
#include <windows.h>
#include <filesystem>
/*
Convert SVG icon to .ICO:
https://redketchup.io/icon-converter
Compile with:
.\script\build.bat
*/
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// Create the webview
webview::webview w(false, nullptr);
w.set_title("TBCalc - Console Calculator");
// Version function
w.bind("appversion", [](std::string s) -> std::string {
return "1.2.0";
});
// Get executable path
wchar_t rawPathName[MAX_PATH] = { 0 };
GetModuleFileNameW(NULL, rawPathName, MAX_PATH);
std::string executablePath = std::filesystem::path(rawPathName).parent_path().string();
// Load local app
w.navigate(executablePath + "\\tbcalc\\index.html");
w.run();
return 0;
}