-
Notifications
You must be signed in to change notification settings - Fork 0
/
binding.cpp
48 lines (37 loc) · 1.23 KB
/
binding.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
43
44
45
46
47
48
#include <v8.h>
#include <node.h>
#include <windows.h>
using namespace std;
using namespace v8;
void HideTaskbar(const FunctionCallbackInfo<Value>& args){
Isolate* isolate = args.GetIsolate();
HWND hwnd = FindWindow(TEXT("Shell_traywnd"), NULL);
HWND hwnd2 = FindWindow(TEXT("Shell_SecondaryTrayWnd"), NULL);
ShowWindow(hwnd, 0);
ShowWindow(hwnd2, 0);
}
void ShowTaskbar(const FunctionCallbackInfo<Value>& args){
Isolate* isolate = args.GetIsolate();
HWND hwnd = FindWindow(TEXT("Shell_traywnd"), NULL);
HWND hwnd2 = FindWindow(TEXT("Shell_SecondaryTrayWnd"), NULL);
ShowWindow(hwnd, 1);
ShowWindow(hwnd2, 1);
}
void ToggleTaskbar(const FunctionCallbackInfo<Value>& args){
Isolate* isolate = args.GetIsolate();
HWND hwnd = FindWindow(TEXT("Shell_traywnd"), NULL);
HWND hwnd2 = FindWindow(TEXT("Shell_SecondaryTrayWnd"), NULL);
if (IsWindowVisible(hwnd)) {
ShowWindow(hwnd, 0);
ShowWindow(hwnd2, 0);
}else{
ShowWindow(hwnd, 1);
ShowWindow(hwnd2, 1);
}
}
void Initialize(Local<Object> exports) {
NODE_SET_METHOD(exports, "hideTaskbar", HideTaskbar);
NODE_SET_METHOD(exports, "showTaskbar", ShowTaskbar);
NODE_SET_METHOD(exports, "toggleTaskbar", ToggleTaskbar);
}
NODE_MODULE(addon, Initialize);