-
Notifications
You must be signed in to change notification settings - Fork 228
/
Copy pathmain.c
47 lines (35 loc) · 1.05 KB
/
main.c
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
43
44
45
46
47
// Virtual File System Example
#include "webui.h"
#include "vfs.h"
void exit_app(webui_event_t* e) {
webui_exit();
}
int main() {
// Create new windows
size_t MyWindow = webui_new_window();
// Bind HTML element IDs with a C functions
webui_bind(MyWindow, "Exit", exit_app);
// VSF (Virtual File System) Example
//
// 1. Run Python script to generate header file of a folder
// python vfs.py "/path/to/folder" "vfs.h"
//
// 2. Include header file in your C project
// #include "vfs.h"
//
// 3. use vfs in your custom files handler `webui_set_file_handler()`
// webui_set_file_handler(MyWindow, vfs);
// Set a custom files handler
webui_set_file_handler(MyWindow, vfs);
// Show a new window
// webui_show_browser(MyWindow, "index.html", Chrome);
webui_show(MyWindow, "index.html");
// Wait until all windows get closed
webui_wait();
// Free all memory resources (Optional)
webui_clean();
return 0;
}
#if defined(_MSC_VER)
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hInstPrev, PSTR cmdline, int cmdshow) { return main(); }
#endif