-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.swg
45 lines (36 loc) · 1.11 KB
/
main.swg
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
var g_App: Application
#main
{
try Jobs.setNumWorkers()
try Library.init()
var path = Library.getFolder()
path = Path.combine(path, "captme.cfg")
g_App.setConfigPath(path)
var img = assume Image.decode(".png", Icons48)
img.crop(48, 48, 48, 48)
img.setPixelFormat(.BGRA8)
g_App.setAppIcon(img)
let surface = try g_App.createSurface(200, 100, 1200, 1000, SurfaceFlags.OverlappedWindow)
let mainWnd = MainWnd.create(surface.wnd)
surface.setView(mainWnd)
mainWnd.createTopMenu()
if Env.hasArg("swag.test"):
g_App.maxRunFrame = 100
catch g_App.loadState()
surface.constaintToScreen()
surface.show()
using Win32
with var tnid: NOTIFYICONDATAA
{
.cbSize = #sizeof(NOTIFYICONDATAA)
.hWnd = surface.hWnd
.uID = 1
.uFlags = NIF_ICON | NIF_MESSAGE
.uCallbackMessage = WM_USER
.hIcon = catch img.toHICON()
}
catch Shell_NotifyIconA(NIM_ADD, &tnid)
g_App.run()
catch g_App.saveState()
catch Shell_NotifyIconA(NIM_DELETE, &tnid)
}