-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwin_main.cpp
42 lines (31 loc) · 1.17 KB
/
win_main.cpp
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
35
36
37
38
39
40
41
42
#include "Application.h"
#include "WindowClient.h"
int main(int argc, char ** argv) {
setlocale(LC_ALL, "");
CefMainArgs main_args(GetModuleHandle(NULL));
CefRefPtr<CefCommandLine> commandLine(CefCommandLine::CreateCommandLine());
commandLine->InitFromString(GetCommandLineW());
CefRefPtr<CefApp> app(new Application());
// Execute the secondary process, if any.
int exit_code = CefExecuteProcess(main_args, app.get(), NULL);
if (exit_code >= 0) {
return exit_code;
}
if (FILE* f = fopen("out.txt", "a")) {
fprintf(f, "CefCommandLine %S\n", commandLine->GetCommandLineString().ToWString().c_str());
fclose(f);
}
printf("CefCommandLine %S\n", commandLine->GetCommandLineString().ToWString().c_str());
if (argc < 2) {
printf("Syntax: %s filename.js [args for js]\n", argv[0]);
return 1;
}
CefRefPtr<WindowClient> client(new WindowClient());
CefSettings appSettings;
appSettings.remote_debugging_port = 24042;
appSettings.log_severity = LOGSEVERITY_DISABLE;
CefInitialize(main_args, appSettings, app, NULL);
CefRunMessageLoop();
CefShutdown();
return s_result;
}