├── bdock.png
├── Src
├── Dock
│ ├── Dock.ico
│ ├── Small.ico
│ ├── AboutDlg.h
│ ├── Timer.h
│ ├── Icon.h
│ ├── stdafx.cpp
│ ├── Settings.h
│ ├── SettingsDlg.h
│ ├── Settings.cpp
│ ├── AboutDlg.cpp
│ ├── stdafx.h
│ ├── Skin.h
│ ├── SettingsDlg.cpp
│ ├── targetver.h
│ ├── resource.h
│ ├── Dock.h
│ ├── Icon.cpp
│ ├── Storage.h
│ ├── Plugin.h
│ ├── Skin.cpp
│ ├── Dock.rc
│ └── main.cpp
├── Plugins
│ ├── SystemTray
│ │ ├── SysTools.h
│ │ ├── stdafx.cpp
│ │ ├── resource.h
│ │ ├── stdafx.h
│ │ ├── targetver.h
│ │ ├── dllmain.cpp
│ │ ├── SystemTray.h
│ │ ├── SystemTray.rc
│ │ ├── SysTools.cpp
│ │ └── SystemTray.cpp
│ ├── Launcher
│ │ ├── SysTools.h
│ │ ├── stdafx.cpp
│ │ ├── stdafx.h
│ │ ├── resource.h
│ │ ├── dllmain.cpp
│ │ ├── Launcher.h
│ │ ├── targetver.h
│ │ ├── Launcher.rc
│ │ └── SysTools.cpp
│ ├── Clock
│ │ ├── stdafx.cpp
│ │ ├── stdafx.h
│ │ ├── Clock.h
│ │ ├── resource.h
│ │ ├── dllmain.cpp
│ │ ├── targetver.h
│ │ ├── Clock.rc
│ │ └── Clock.cpp
│ └── HideTaskbar
│ │ ├── stdafx.cpp
│ │ ├── stdafx.h
│ │ ├── resource.h
│ │ ├── HideTaskbar.h
│ │ ├── dllmain.cpp
│ │ ├── targetver.h
│ │ ├── HideTaskbar.rc
│ │ └── HideTaskbar.cpp
└── Dock2.h
├── .gitignore
├── Skins
├── Classic
│ ├── midBg.bmp
│ ├── activeBg.bmp
│ ├── fullBg.bmp
│ ├── halfBg.bmp
│ ├── leftBg.bmp
│ └── rightBg.bmp
└── Default
│ ├── hotBg.bmp
│ ├── activeBg.bmp
│ ├── fullBg.bmp
│ ├── halfBg.bmp
│ └── defaultBg.bmp
├── .gitmodules
├── TODO.txt
├── Nsis
├── bdock_32-bit.nsi
├── bdock_64-bit.nsi
└── bdock.nsh
├── libWinAPI.vcxproj.filters
├── NOTICE
├── Clock.vcxproj.filters
├── HideTaskbar.vcxproj.filters
├── Launcher.vcxproj.filters
├── SystemTray.vcxproj.filters
├── README.md
├── Dock.vcxproj.filters
├── libnstd.vcxproj.filters
├── Marefile
├── Ext
└── libWinAPI
│ └── include
│ └── WinAPI.h
├── Dock.sln
├── libWinAPI.vcxproj
├── libnstd.vcxproj
├── LICENSE
├── Clock.vcxproj
├── HideTaskbar.vcxproj
└── Launcher.vcxproj
/bdock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/craflin/bdock/master/bdock.png
--------------------------------------------------------------------------------
/Src/Dock/Dock.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/craflin/bdock/master/Src/Dock/Dock.ico
--------------------------------------------------------------------------------
/Src/Dock/Small.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/craflin/bdock/master/Src/Dock/Small.ico
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | Build
2 | ipch
3 | *.sdf
4 | *.opensdf
5 | *.suo
6 | *.vcxproj.user
7 | *.aps
8 |
--------------------------------------------------------------------------------
/Skins/Classic/midBg.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/craflin/bdock/master/Skins/Classic/midBg.bmp
--------------------------------------------------------------------------------
/Skins/Default/hotBg.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/craflin/bdock/master/Skins/Default/hotBg.bmp
--------------------------------------------------------------------------------
/Skins/Classic/activeBg.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/craflin/bdock/master/Skins/Classic/activeBg.bmp
--------------------------------------------------------------------------------
/Skins/Classic/fullBg.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/craflin/bdock/master/Skins/Classic/fullBg.bmp
--------------------------------------------------------------------------------
/Skins/Classic/halfBg.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/craflin/bdock/master/Skins/Classic/halfBg.bmp
--------------------------------------------------------------------------------
/Skins/Classic/leftBg.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/craflin/bdock/master/Skins/Classic/leftBg.bmp
--------------------------------------------------------------------------------
/Skins/Classic/rightBg.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/craflin/bdock/master/Skins/Classic/rightBg.bmp
--------------------------------------------------------------------------------
/Skins/Default/activeBg.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/craflin/bdock/master/Skins/Default/activeBg.bmp
--------------------------------------------------------------------------------
/Skins/Default/fullBg.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/craflin/bdock/master/Skins/Default/fullBg.bmp
--------------------------------------------------------------------------------
/Skins/Default/halfBg.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/craflin/bdock/master/Skins/Default/halfBg.bmp
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "Ext/libnstd"]
2 | path = Ext/libnstd
3 | url = git@github.com:craflin/libnstd.git
4 |
--------------------------------------------------------------------------------
/Src/Plugins/SystemTray/SysTools.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | HBITMAP createBitmapFromIcon(HICON icon, SIZE* size);
5 |
--------------------------------------------------------------------------------
/TODO.txt:
--------------------------------------------------------------------------------
1 | Tasks:
2 | - Settings dialog
3 | - System-Tray icons (volume control, network interfaces, battery)
4 | - Clock plugin
5 |
--------------------------------------------------------------------------------
/Src/Plugins/Launcher/SysTools.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | HMENU CopyMenu(HMENU hmenu);
5 | HBITMAP CreateBitmapFromIcon(UINT destWidth, UINT destHeight, HICON icon);
6 |
7 | BOOL GetCommandLine(DWORD pid, LPWSTR commandLine, UINT maxLen);
8 |
--------------------------------------------------------------------------------
/Src/Dock/AboutDlg.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | class AboutDlg : private WinAPI::Dialog
5 | {
6 | public:
7 | AboutDlg() {}
8 |
9 | UINT show(HWND hwndParent);
10 |
11 | private:
12 | virtual bool onDlgMessage(UINT message, WPARAM wParam, LPARAM lParam);
13 | };
14 |
--------------------------------------------------------------------------------
/Src/Dock/Timer.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | class Plugin;
5 |
6 | class Timer : public API::Timer
7 | {
8 | public:
9 | Plugin* plugin;
10 | uint_t id;
11 |
12 | Timer(uint_t interval, Plugin* plugin) : plugin(plugin), id(0) { this->interval = interval; }
13 | };
14 |
--------------------------------------------------------------------------------
/Src/Dock/Icon.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | class Plugin;
5 | class Dock;
6 |
7 | class Icon : public API::Icon
8 | {
9 | public:
10 | Plugin* plugin;
11 | RECT rect;
12 |
13 | Icon(HBITMAP icon, uint_t flags, Plugin* plugin);
14 |
15 | void draw(HDC dest, const Settings& settings);
16 | };
17 |
--------------------------------------------------------------------------------
/Src/Dock/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // bdock.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/Src/Plugins/Clock/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // launcher.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/Src/Plugins/HideTaskbar/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // launcher.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/Src/Plugins/Launcher/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // launcher.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/Src/Plugins/SystemTray/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // launcher.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/Nsis/bdock_32-bit.nsi:
--------------------------------------------------------------------------------
1 | ; bdock - NSIS Installer Script
2 | ; Copyright (C) 2013 Colin Graf
3 |
4 | ;--------------------------------
5 |
6 | !define DISPLAYNAME "BDock"
7 | !define VERSION "0.3"
8 | !define PUBLISHER "Colin Graf"
9 | !define BUILDDIR "Build\Release_Win32"
10 | !define ARCHITECTURE "32-bit"
11 |
12 | !include "bdock.nsh"
13 |
14 |
--------------------------------------------------------------------------------
/Nsis/bdock_64-bit.nsi:
--------------------------------------------------------------------------------
1 | ; bdock - NSIS Installer Script
2 | ; Copyright (C) 2013 Colin Graf
3 |
4 | ;--------------------------------
5 |
6 | !define DISPLAYNAME "BDock (64-bit)"
7 | !define VERSION "0.3"
8 | !define PUBLISHER "Colin Graf"
9 | !define BUILDDIR "Build\Release_x64"
10 | !define ARCHITECTURE "64-bit"
11 |
12 | !include "bdock.nsh"
13 |
--------------------------------------------------------------------------------
/libWinAPI.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Src/Plugins/Clock/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #include "targetver.h"
9 |
10 | #include
11 | #include
12 |
13 | #include "../../Dock2.h"
14 |
15 | #include "Clock.h"
16 |
--------------------------------------------------------------------------------
/Src/Plugins/HideTaskbar/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #include "targetver.h"
9 |
10 | #include
11 | #include
12 |
13 | #include "../../Dock2.h"
14 |
15 | #include "HideTaskbar.h"
16 |
--------------------------------------------------------------------------------
/Src/Plugins/Clock/Clock.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | class Clock
5 | {
6 | public:
7 | Clock(Dock& dock);
8 | ~Clock();
9 |
10 | bool init();
11 |
12 | private:
13 | Dock& dock;
14 | HBITMAP bitmap;
15 | HFONT font;
16 | HBRUSH bgBrush;
17 | COLORREF textColor;
18 | Icon* icon;
19 | COLORREF* bitmapData;
20 | Timer* timer;
21 | SYSTEMTIME st;
22 |
23 | static int handleTimerEvent(Timer* timer);
24 |
25 | void update();
26 | };
27 |
--------------------------------------------------------------------------------
/Src/Plugins/Clock/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by HideTaskbar.rc
4 | //
5 |
6 | // Next default values for new objects
7 | //
8 | #ifdef APSTUDIO_INVOKED
9 | #ifndef APSTUDIO_READONLY_SYMBOLS
10 | #define _APS_NEXT_RESOURCE_VALUE 102
11 | #define _APS_NEXT_COMMAND_VALUE 40001
12 | #define _APS_NEXT_CONTROL_VALUE 1001
13 | #define _APS_NEXT_SYMED_VALUE 101
14 | #endif
15 | #endif
16 |
--------------------------------------------------------------------------------
/Src/Plugins/SystemTray/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by SystemTray.rc
4 | //
5 |
6 | // Next default values for new objects
7 | //
8 | #ifdef APSTUDIO_INVOKED
9 | #ifndef APSTUDIO_READONLY_SYMBOLS
10 | #define _APS_NEXT_RESOURCE_VALUE 102
11 | #define _APS_NEXT_COMMAND_VALUE 40001
12 | #define _APS_NEXT_CONTROL_VALUE 1001
13 | #define _APS_NEXT_SYMED_VALUE 101
14 | #endif
15 | #endif
16 |
--------------------------------------------------------------------------------
/Src/Plugins/HideTaskbar/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by HideTaskbar.rc
4 | //
5 |
6 | // Next default values for new objects
7 | //
8 | #ifdef APSTUDIO_INVOKED
9 | #ifndef APSTUDIO_READONLY_SYMBOLS
10 | #define _APS_NEXT_RESOURCE_VALUE 102
11 | #define _APS_NEXT_COMMAND_VALUE 40001
12 | #define _APS_NEXT_CONTROL_VALUE 1001
13 | #define _APS_NEXT_SYMED_VALUE 101
14 | #endif
15 | #endif
16 |
--------------------------------------------------------------------------------
/Src/Plugins/SystemTray/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #include "targetver.h"
9 |
10 | #include
11 | #include
12 |
13 | #include "../../Dock2.h"
14 |
15 | #include
16 | #include
17 | #include
18 |
19 | #include "SystemTray.h"
20 | #include "SysTools.h"
21 |
--------------------------------------------------------------------------------
/Src/Dock/Settings.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | class Settings
5 | {
6 | public:
7 | enum Alignment
8 | {
9 | center,
10 | left,
11 | right,
12 | top,
13 | bottom,
14 | };
15 |
16 | int barHeight;
17 | int leftMargin;
18 | int topMargin; // animation and text draw area
19 | int rightMargin;
20 | int bottomMargin;
21 | int itemWidth;
22 | int iconWidth;
23 | int iconHeight;
24 | Alignment alignment;
25 | Alignment edge;
26 |
27 | Settings(Storage& storage);
28 | };
29 |
--------------------------------------------------------------------------------
/Src/Plugins/HideTaskbar/HideTaskbar.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | class HideTaskBar
5 | {
6 | public:
7 | HideTaskBar();
8 | ~HideTaskBar();
9 |
10 | bool init();
11 |
12 | private:
13 | static int instances;
14 | static bool hidden;
15 | static LPARAM originalState;
16 |
17 | static ATOM wndClass;
18 | static HWND hwnd;
19 |
20 | static bool showTaskBar(bool show, LPARAM& state);
21 |
22 | static LRESULT CALLBACK HideTaskBar::wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
23 | };
24 |
25 |
--------------------------------------------------------------------------------
/Src/Dock/SettingsDlg.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | class Storage;
5 |
6 | class SettingsDlg : private WinAPI::Dialog
7 | {
8 | public:
9 | SettingsDlg(Storage& globalStorage) : globalStorage(globalStorage) {}
10 |
11 | UINT show(HWND hwndParent);
12 |
13 | private:
14 | Storage& globalStorage;
15 |
16 | WinAPI::ImageList pageImageList;
17 | WinAPI::TreeView pageTreeView;
18 |
19 | WinAPI::Button autostartButton;
20 |
21 | virtual bool onInitDialog();
22 | virtual bool onCommand(UINT command, HWND source);
23 | };
24 |
--------------------------------------------------------------------------------
/Src/Plugins/Launcher/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #include "targetver.h"
9 |
10 | #include
11 |
12 | #include "resource.h"
13 |
14 | #include "../../Dock2.h"
15 |
16 | #include
17 | #include
18 | #include
19 | #include
20 |
21 | #include "Launcher.h"
22 | #include "SysTools.h"
23 |
--------------------------------------------------------------------------------
/Src/Plugins/Launcher/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by launcher.rc
4 | //
5 | #define IDS_PIN 101
6 | #define IDS_UNPIN 102
7 | #define IDS_LAUNCH 103
8 |
9 | // Next default values for new objects
10 | //
11 | #ifdef APSTUDIO_INVOKED
12 | #ifndef APSTUDIO_READONLY_SYMBOLS
13 | #define _APS_NEXT_RESOURCE_VALUE 102
14 | #define _APS_NEXT_COMMAND_VALUE 40001
15 | #define _APS_NEXT_CONTROL_VALUE 1001
16 | #define _APS_NEXT_SYMED_VALUE 101
17 | #endif
18 | #endif
19 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 |
2 | Copyright 2009-2013 Colin Graf
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 |
--------------------------------------------------------------------------------
/Src/Dock/Settings.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | Settings::Settings(Storage& storage) :
5 | barHeight(storage.getInt(_T("barHeight"), 57)),
6 | leftMargin(storage.getInt(_T("leftMargin"), 25)),
7 | topMargin(storage.getInt(_T("topMargin"), 10)),
8 | rightMargin(storage.getInt(_T("rightMargin"), 25)),
9 | bottomMargin(storage.getInt(_T("bottomMargin"), 2)),
10 | itemWidth(storage.getInt(_T("itemWidth"), 42)),
11 | iconWidth(storage.getInt(_T("iconWidth"), 32)),
12 | iconHeight(storage.getInt(_T("iconHeight"), 32)),
13 | alignment(Alignment(storage.getInt(_T("alignment"), center))),
14 | edge(Alignment(storage.getInt(_T("edge"), bottom)))
15 | {}
16 |
--------------------------------------------------------------------------------
/Src/Dock/AboutDlg.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 |
5 | UINT AboutDlg::show(HWND hwndParent)
6 | {
7 | return WinAPI::Dialog::show(IDD_ABOUTBOX, hwndParent);
8 | }
9 |
10 | bool AboutDlg::onDlgMessage(UINT message, WPARAM wParam, LPARAM lParam)
11 | {
12 | switch(message)
13 | {
14 | case WM_NOTIFY:
15 | switch (((LPNMHDR)lParam)->code)
16 | {
17 | case NM_CLICK:
18 | case NM_RETURN:
19 | {
20 | PNMLINK pNMLink = (PNMLINK)lParam;
21 | LITEM item = pNMLink->item;
22 | WinAPI::Shell::execute(NULL, _T("open"), item.szUrl, NULL, NULL, SW_SHOW);
23 | return true;
24 | }
25 | }
26 |
27 | }
28 | return WinAPI::Dialog::onDlgMessage(message, wParam, lParam);
29 | }
30 |
--------------------------------------------------------------------------------
/Clock.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Src/Dock/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #include "targetver.h"
9 |
10 | #include
11 |
12 | #include "resource.h"
13 |
14 | namespace API
15 | {
16 | #include "../Dock2.h"
17 | };
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | #include "Storage.h"
28 | #include "Settings.h"
29 | #include "Skin.h"
30 | #include "Icon.h"
31 | #include "Timer.h"
32 | #include "Plugin.h"
33 | #include "Dock.h"
34 | #include "AboutDlg.h"
35 | #include "SettingsDlg.h"
36 |
37 |
38 |
--------------------------------------------------------------------------------
/HideTaskbar.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Src/Dock/Skin.h:
--------------------------------------------------------------------------------
1 |
2 |
3 | #pragma once
4 |
5 | class Skin
6 | {
7 | public:
8 | class Bitmap
9 | {
10 | public:
11 | HBITMAP bmp;
12 | SIZE size;
13 |
14 | void draw(HDC dest, int x, int y) const;
15 |
16 | private:
17 | Bitmap();
18 | ~Bitmap();
19 |
20 | bool load(const wchar_t* file);
21 |
22 | friend class Skin;
23 | };
24 |
25 | // dock backround
26 | Bitmap leftBg;
27 | Bitmap rightBg;
28 | Bitmap midBg;
29 |
30 | // icon background
31 | Bitmap activeBg;
32 | Bitmap defaultBg;
33 | Bitmap hotBg;
34 | Bitmap fullBg;
35 | Bitmap halfBg;
36 |
37 | Skin();
38 | ~Skin();
39 |
40 | bool init(const String& name);
41 |
42 | void draw(HDC dest, const SIZE& size, const RECT& update);
43 |
44 | private:
45 | HBRUSH bgBrush;
46 | HBITMAP bg;
47 | SIZE bgSize;
48 | };
49 |
--------------------------------------------------------------------------------
/Launcher.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Src/Plugins/Launcher/dllmain.cpp:
--------------------------------------------------------------------------------
1 | // dllmain.cpp : Defines the entry point for the DLL application.
2 | #include "stdafx.h"
3 |
4 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
5 | {
6 | switch (ul_reason_for_call)
7 | {
8 | case DLL_PROCESS_ATTACH:
9 | WinAPI::Application::setModule(hModule);
10 | break;
11 | case DLL_THREAD_ATTACH:
12 | case DLL_THREAD_DETACH:
13 | break;
14 | case DLL_PROCESS_DETACH:
15 | break;
16 | }
17 | return TRUE;
18 | }
19 |
20 | extern "C" __declspec(dllexport) struct Plugin* create(struct Dock* dock)
21 | {
22 | return (Plugin*) new Launcher(*dock);
23 | }
24 |
25 | extern "C" __declspec(dllexport) int init(struct Plugin* plugin)
26 | {
27 | if(!((Launcher*)plugin)->create())
28 | return -1;
29 | return 0;
30 | }
31 |
32 | extern "C" __declspec(dllexport) void destroy(struct Plugin* plugin)
33 | {
34 | delete (Launcher*)plugin;
35 | }
36 |
--------------------------------------------------------------------------------
/SystemTray.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Src/Plugins/Clock/dllmain.cpp:
--------------------------------------------------------------------------------
1 | // dllmain.cpp : Defines the entry point for the DLL application.
2 | #include "stdafx.h"
3 |
4 | HMODULE hmodule = 0;
5 |
6 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
7 | {
8 | switch (ul_reason_for_call)
9 | {
10 | case DLL_PROCESS_ATTACH:
11 | hmodule = hModule;
12 | break;
13 | case DLL_THREAD_ATTACH:
14 | case DLL_THREAD_DETACH:
15 | break;
16 | case DLL_PROCESS_DETACH:
17 | hmodule = 0;
18 | break;
19 | }
20 | return TRUE;
21 | }
22 |
23 | extern "C" __declspec(dllexport) struct Plugin* create(struct Dock* dock)
24 | {
25 | return (Plugin*) new Clock(*dock);
26 | }
27 |
28 | extern "C" __declspec(dllexport) int init(struct Plugin* plugin)
29 | {
30 | if(!((Clock*)plugin)->init())
31 | return -1;
32 | return 0;
33 | }
34 |
35 | extern "C" __declspec(dllexport) void destroy(struct Plugin* plugin)
36 | {
37 | delete (Clock*)plugin;
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/Src/Plugins/HideTaskbar/dllmain.cpp:
--------------------------------------------------------------------------------
1 | // dllmain.cpp : Defines the entry point for the DLL application.
2 | #include "stdafx.h"
3 |
4 | HMODULE hmodule = 0;
5 |
6 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
7 | {
8 | switch (ul_reason_for_call)
9 | {
10 | case DLL_PROCESS_ATTACH:
11 | hmodule = hModule;
12 | break;
13 | case DLL_THREAD_ATTACH:
14 | case DLL_THREAD_DETACH:
15 | break;
16 | case DLL_PROCESS_DETACH:
17 | hmodule = 0;
18 | break;
19 | }
20 | return TRUE;
21 | }
22 |
23 | extern "C" __declspec(dllexport) struct Plugin* create(struct Dock* dock)
24 | {
25 | return (Plugin*) new HideTaskBar;
26 | }
27 |
28 | extern "C" __declspec(dllexport) int init(struct Plugin* plugin)
29 | {
30 | if(!((HideTaskBar*)plugin)->init())
31 | return -1;
32 | return 0;
33 | }
34 |
35 | extern "C" __declspec(dllexport) void destroy(struct Plugin* plugin)
36 | {
37 | delete (HideTaskBar*)plugin;
38 | }
39 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | BDock
2 | =====
3 |
4 | 
5 |
6 | BDock is a very basic dock style launcher for Windows 7.
7 | It hides the Windows taskbar and adds an overlay (the Dock) to your desktop.
8 | The Dock lists all running applications similar to the taskbar and allows you to switch between the windows on your desktop.
9 | The Windows taskbar (and the Windows start menu) can be recovered using the Windows key.
10 | BDock was not tested on any other version of Windows than Windows 7 64-bit.
11 |
12 | BDock is written in C++ without any third party libraries or toolkits.
13 | You need Visual Studio 2010 (or newer) if you want to compile it yourself.
14 |
15 | Change Log
16 | ----------
17 |
18 | v0.3
19 | * Added launcher icon drag & drop
20 | * Optimized launcher performance
21 | * Fixed not working pinned icon saving
22 | * Fixed various minor issues
23 |
24 | v0.2
25 | * Added mouseover icon background
26 | * Added launcher hotkeys for switching applications (Win + Alt + Left / Right)
27 | * Changed background of activated icons
28 | * Fixed various minor issues
29 |
30 | v0.1
31 | * Initial release
--------------------------------------------------------------------------------
/Src/Dock/SettingsDlg.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | UINT SettingsDlg::show(HWND hwndParent)
5 | {
6 | return WinAPI::Dialog::show(IDD_SETTINGS, hwndParent);
7 | }
8 |
9 | bool SettingsDlg::onInitDialog()
10 | {
11 | /*
12 | VERIFY(pageImageList.create(16, 16, ILC_COLOR32, 3, 3));
13 | VERIFY(pageImageList.add(WinAPI::Icon(IDI_BDOCK)) == 0);
14 |
15 | VERIFY(pageTreeView.initialize(*this, IDC_PAGE_TREE));
16 | VERIFY(pageTreeView.setTheme(_T("Explorer"), NULL));
17 | VERIFY(pageTreeView.setImageList(pageImageList, TVSIL_NORMAL));
18 | */
19 | VERIFY(autostartButton.initialize(*this, IDC_AUTOSTART));
20 |
21 | VERIFY(autostartButton.setCheck(globalStorage.getUInt(_T("autostart"), 0) ? BST_CHECKED : BST_UNCHECKED));
22 | /*
23 | WinAPI::String text(IDS_SETTINGS_PAGE_GENERAL);
24 |
25 | TVINSERTSTRUCT item;
26 | item.hParent = TVI_ROOT;
27 | item.hInsertAfter = TVI_LAST;
28 | item.itemex.mask = TVIF_TEXT | TVIF_IMAGE;
29 | item.itemex.pszText = (LPTSTR) (LPCTSTR) text;
30 | item.itemex.iImage = 0;
31 | pageTreeView.insertItem(item);
32 | */
33 | return WinAPI::Dialog::onInitDialog();
34 | }
35 |
36 | bool SettingsDlg::onCommand(UINT command, HWND source)
37 | {
38 | if(command == IDOK)
39 | {
40 | bool autostart = autostartButton.getCheck() == BST_CHECKED;
41 | globalStorage.setUInt(_T("autostart"), autostart);
42 | }
43 | return WinAPI::Dialog::onCommand(command, source);
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/Src/Plugins/Launcher/Launcher.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | class Launcher;
5 |
6 | class IconData
7 | {
8 | public:
9 | Launcher& launcher;
10 | HICON hicon;
11 | Icon* icon;
12 | HWND hwnd;
13 | String path;
14 | String parameters;
15 | bool pinned; // TODO: remove this and use launcherIndex >= 0 ?
16 | int launcherIndex;
17 |
18 | IconData(Launcher& launcher, HICON hicon, Icon* icon, HWND hwnd, const String& path, const String& parameters, int launcherIndex);
19 | ~IconData();
20 | };
21 |
22 | class Launcher : public WinAPI::Window
23 | {
24 | public:
25 | Dock& dock;
26 |
27 | Launcher(Dock& dock);
28 | ~Launcher();
29 |
30 | bool create();
31 |
32 | private:
33 | WinAPI::Icon defaultIcon;
34 | HWND activeHwnd;
35 | IconData* hotIcon;
36 | HashSet icons;
37 | HashMap iconsByHWND;
38 |
39 | static int handleMouseEvent(Icon* icon, unsigned int message, int x, int y);
40 | static int handleMoveEvent(Icon* icon);
41 |
42 | virtual LRESULT onMessage(UINT message, WPARAM wParam, LPARAM lParam);
43 |
44 | void addIcon(HWND hwnd);
45 | void activateIcon(HWND hwnd);
46 | void removeIcon(HWND hwnd);
47 | void removeIcon(IconData& iconData);
48 | void updateIcon(HWND hwnd, bool forceUpdate);
49 |
50 | static bool hasTaskBarIcon(HWND hwnd);
51 |
52 | void showContextMenu(Icon* icon, int x, int y);
53 | bool launch(Icon& icon);
54 | static bool getCommandLine(HWND hwnd, String& path, String& parameters);
55 | };
56 |
--------------------------------------------------------------------------------
/Src/Dock/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // The following macros define the minimum required platform. The minimum required platform
4 | // is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
5 | // your application. The macros work by enabling all features available on platform versions up to and
6 | // including the version specified.
7 |
8 | // Modify the following defines if you have to target a platform prior to the ones specified below.
9 | // Refer to MSDN for the latest info on corresponding values for different platforms.
10 | #ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
11 | #define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
12 | #endif
13 |
14 | #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
15 | #define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
16 | #endif
17 |
18 | #ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
19 | #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
20 | #endif
21 |
22 | #ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
23 | #define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
24 | #endif
25 |
--------------------------------------------------------------------------------
/Src/Plugins/Clock/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // The following macros define the minimum required platform. The minimum required platform
4 | // is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
5 | // your application. The macros work by enabling all features available on platform versions up to and
6 | // including the version specified.
7 |
8 | // Modify the following defines if you have to target a platform prior to the ones specified below.
9 | // Refer to MSDN for the latest info on corresponding values for different platforms.
10 | #ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
11 | #define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
12 | #endif
13 |
14 | #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
15 | #define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
16 | #endif
17 |
18 | #ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
19 | #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
20 | #endif
21 |
22 | #ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
23 | #define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
24 | #endif
25 |
--------------------------------------------------------------------------------
/Src/Plugins/Launcher/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // The following macros define the minimum required platform. The minimum required platform
4 | // is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
5 | // your application. The macros work by enabling all features available on platform versions up to and
6 | // including the version specified.
7 |
8 | // Modify the following defines if you have to target a platform prior to the ones specified below.
9 | // Refer to MSDN for the latest info on corresponding values for different platforms.
10 | #ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
11 | #define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
12 | #endif
13 |
14 | #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
15 | #define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
16 | #endif
17 |
18 | #ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
19 | #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
20 | #endif
21 |
22 | #ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
23 | #define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
24 | #endif
25 |
--------------------------------------------------------------------------------
/Src/Plugins/HideTaskbar/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // The following macros define the minimum required platform. The minimum required platform
4 | // is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
5 | // your application. The macros work by enabling all features available on platform versions up to and
6 | // including the version specified.
7 |
8 | // Modify the following defines if you have to target a platform prior to the ones specified below.
9 | // Refer to MSDN for the latest info on corresponding values for different platforms.
10 | #ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
11 | #define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
12 | #endif
13 |
14 | #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
15 | #define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
16 | #endif
17 |
18 | #ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
19 | #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
20 | #endif
21 |
22 | #ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
23 | #define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
24 | #endif
25 |
--------------------------------------------------------------------------------
/Src/Plugins/SystemTray/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // The following macros define the minimum required platform. The minimum required platform
4 | // is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
5 | // your application. The macros work by enabling all features available on platform versions up to and
6 | // including the version specified.
7 |
8 | // Modify the following defines if you have to target a platform prior to the ones specified below.
9 | // Refer to MSDN for the latest info on corresponding values for different platforms.
10 | #ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
11 | #define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
12 | #endif
13 |
14 | #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
15 | #define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
16 | #endif
17 |
18 | #ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
19 | #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
20 | #endif
21 |
22 | #ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
23 | #define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
24 | #endif
25 |
--------------------------------------------------------------------------------
/Src/Dock/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Dock.rc
4 | //
5 | #define IDC_MYICON 2
6 | #define IDD_BDOCK_DIALOG 102
7 | #define IDS_APP_TITLE 103
8 | #define IDD_ABOUTBOX 103
9 | #define IDM_ABOUT 104
10 | #define IDS_SETTINGS_PAGE_GENERAL 104
11 | #define IDM_EXIT 105
12 | #define IDI_BDOCK 107
13 | #define IDI_SMALL 108
14 | #define IDC_BDOCK 109
15 | #define IDR_MAINFRAME 128
16 | #define IDD_SETTINGS 129
17 | #define IDC_AUTOSTART 1000
18 | #define IDC_PAGE_LIST 1001
19 | #define IDC_SYSLINK1 1003
20 | #define IDC_TREE1 1006
21 | #define IDC_PAGE_TREE 1006
22 | #define ID_DOCK_ABOUTBDOCK 32771
23 | #define ID_DOCK_SETTINGS 32772
24 | #define IDM_SETTINGS 32773
25 | #define IDC_STATIC -1
26 |
27 | // Next default values for new objects
28 | //
29 | #ifdef APSTUDIO_INVOKED
30 | #ifndef APSTUDIO_READONLY_SYMBOLS
31 | #define _APS_NO_MFC 1
32 | #define _APS_NEXT_RESOURCE_VALUE 130
33 | #define _APS_NEXT_COMMAND_VALUE 32774
34 | #define _APS_NEXT_CONTROL_VALUE 1007
35 | #define _APS_NEXT_SYMED_VALUE 110
36 | #endif
37 | #endif
38 |
--------------------------------------------------------------------------------
/Dock.vcxproj.filters:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/Src/Plugins/SystemTray/dllmain.cpp:
--------------------------------------------------------------------------------
1 | // dllmain.cpp : Defines the entry point for the DLL application.
2 | #include "stdafx.h"
3 |
4 | HMODULE hmodule = 0;
5 |
6 | HWND hookedWnd = 0;
7 |
8 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
9 | {
10 | switch (ul_reason_for_call)
11 | {
12 | case DLL_PROCESS_ATTACH:
13 | hmodule = hModule;
14 | {
15 | WCHAR filename[MAX_PATH];
16 | GetModuleFileName(NULL, filename, MAX_PATH);
17 | wchar_t* name = wcsrchr(filename, L'\\');
18 | if(name && !_wcsicmp(name + 1, L"explorer.exe"))
19 | { // thats it! we, are running in the address space of explorer.exe
20 | hookedWnd = FindWindow(L"Shell_TrayWnd", 0);
21 | if(hookedWnd)
22 | {
23 | TrayWndProc = (WNDPROC)GetWindowLongPtr(hookedWnd, GWLP_WNDPROC);
24 | SetWindowLongPtr(hookedWnd, GWLP_WNDPROC, (LONG_PTR)TrayWndProcHook);
25 | }
26 | }
27 | }
28 | break;
29 | case DLL_THREAD_ATTACH:
30 | case DLL_THREAD_DETACH:
31 | break;
32 | case DLL_PROCESS_DETACH:
33 | hmodule = 0;
34 | if(hookedWnd)
35 | {
36 | if(TrayWndProc)
37 | {
38 | SetWindowLongPtr(hookedWnd, GWLP_WNDPROC, (LONG_PTR)TrayWndProc);
39 | TrayWndProc = 0;
40 | }
41 | hookedWnd = 0;
42 | }
43 | break;
44 | }
45 | return TRUE;
46 | }
47 |
48 | extern "C" __declspec(dllexport) struct Plugin* create(struct Dock* dock)
49 | {
50 | return (Plugin*) new SystemTray(*dock);
51 | }
52 |
53 | extern "C" __declspec(dllexport) int init(struct Plugin* plugin)
54 | {
55 | if(!((SystemTray*)plugin)->init())
56 | return -1;
57 | return 0;
58 | }
59 |
60 | extern "C" __declspec(dllexport) void destroy(struct Plugin* plugin)
61 | {
62 | delete (SystemTray*)plugin;
63 | }
64 |
65 |
--------------------------------------------------------------------------------
/Src/Plugins/SystemTray/SystemTray.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | class DllInjection
5 | {
6 | public:
7 | DllInjection();
8 | ~DllInjection();
9 |
10 | bool init(DWORD pid, const wchar_t* dll);
11 |
12 | private:
13 | HANDLE process;
14 | public:
15 | HMODULE injectedModule;
16 | };
17 |
18 | extern WNDPROC TrayWndProc;
19 | LRESULT CALLBACK TrayWndProcHook(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
20 |
21 | typedef struct _NOTIFYICONDATA32 {
22 | DWORD cbSize;
23 | DWORD hWnd;
24 | UINT uID;
25 | UINT uFlags;
26 | UINT uCallbackMessage;
27 | DWORD hIcon;
28 | WCHAR szTip[128];
29 | DWORD dwState;
30 | DWORD dwStateMask;
31 | WCHAR szInfo[256];
32 | union {
33 | UINT uTimeout;
34 | UINT uVersion; // used with NIM_SETVERSION, values 0, 3 and 4
35 | } DUMMYUNIONNAME;
36 | WCHAR szInfoTitle[64];
37 | DWORD dwInfoFlags;
38 | GUID guidItem;
39 | DWORD hBalloonIcon;
40 | } NOTIFYICONDATA32, *PNOTIFYICONDATA32;
41 |
42 | class SystemTray;
43 |
44 | class IconData
45 | {
46 | public:
47 | SystemTray& systemTray;
48 | HICON hicon;
49 | Icon* icon;
50 | HWND hwnd;
51 | uint_t callbackMessage;
52 | uint_t version;
53 | uint_t id;
54 |
55 | IconData(SystemTray& systemTray, HICON hicon, Icon* icon, PNOTIFYICONDATA32 nid);
56 | ~IconData();
57 | };
58 |
59 | class SystemTray
60 | {
61 | public:
62 | Dock& dock;
63 |
64 | SystemTray(Dock& dock);
65 | ~SystemTray();
66 |
67 | bool init();
68 |
69 | private:
70 | static ATOM wndClass;
71 | static int instances;
72 |
73 | DllInjection dllInjection;
74 | HWND hwnd;
75 | HashMap icons;
76 |
77 | static int handleMouseEvent(Icon* icon, unsigned int message, int x, int y);
78 | static LRESULT CALLBACK wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
79 |
80 | void addIcon(PNOTIFYICONDATA32 nid);
81 | void updateIcon2(PNOTIFYICONDATA32 nid);
82 | void removeIcon(PNOTIFYICONDATA32 nid);
83 | void setIconVersion(PNOTIFYICONDATA32 nid);
84 | };
85 |
--------------------------------------------------------------------------------
/Src/Dock/Dock.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | class Icon;
5 | class Plugin;
6 |
7 | class Dock : private WinAPI::Window
8 | {
9 | public:
10 | Dock(Storage& globalStorage, Storage& dockStorage);
11 | ~Dock();
12 |
13 | bool create();
14 | const POINT& getPosition() {return pos;}
15 |
16 | void addIcon(Icon* insertAfter, Icon* icon);
17 | void removeIcon(Icon* icon);
18 | void addTimer(Timer* timer);
19 | void removeTimer(Timer* timer);
20 |
21 | void updateIcon(Icon* icon);
22 | void updateTimer(Timer* timer);
23 | void update();
24 |
25 | bool showSettingsDlg();
26 |
27 | bool saveStorage();
28 |
29 | // api functions
30 | DWORD showMenu(HMENU hmenu, int x, int y);
31 |
32 | private:
33 | Settings settings;
34 | POINT pos;
35 | Storage& globalStorage;
36 | Storage& dockStorage;
37 | Skin* skin;
38 | HBITMAP bmp;
39 | SIZE size;
40 | HashSet icons;
41 | Icon* lastHitIcon;
42 | Icon* hotIcon;
43 | HashSet plugins;
44 | HashSet timers;
45 |
46 | enum DragState
47 | {
48 | DRAG_IDLE,
49 | DRAG_CLICKED,
50 | DRAG_STARTED,
51 | } dragState;
52 | POINT dragPosition;
53 | Icon* dragIcon;
54 | HIMAGELIST hDragImageList;
55 |
56 | bool loadSkin(const String& name);
57 | bool loadPlugin(const String& name, Storage& storage);
58 |
59 | void addPlugin(Plugin* plugin) { plugins.append(plugin); }
60 | void removePlugin(Plugin* plugin) { plugins.remove(plugin); }
61 | void deletePlugin(Plugin* plugin);
62 |
63 | void update(RECT* update);
64 | void draw(HDC dest, const RECT& update);
65 | void calcIconRects(const HashSet::Iterator& firstToUpdate);
66 |
67 | Icon* hitTest(int x, int y);
68 |
69 | void dragStart(Icon& icon, int x, int y);
70 | void dragFinish();
71 | void dragMove(int x, int y);
72 |
73 | void handleContextMenu(int x, int y);
74 | bool handleMouseEvent(UINT message, int x, int y);
75 |
76 | virtual LRESULT onMessage(UINT message, WPARAM wParam, LPARAM lParam);
77 |
78 | static bool isFullscreen(HWND hwnd, HMONITOR hmon);
79 | };
80 |
--------------------------------------------------------------------------------
/Src/Dock/Icon.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | Icon::Icon(HBITMAP icon, uint_t flags, Plugin* plugin) :
5 | plugin(plugin)
6 | {
7 | memset((API::Icon*)this, 0, sizeof(API::Icon));
8 | this->icon = icon;
9 | this->flags = flags;
10 | }
11 |
12 | void Icon::draw(HDC dest, const Settings& settings)
13 | {
14 | if(!icon)
15 | return;
16 |
17 | BITMAP bm;
18 | if(!GetObject(icon, sizeof(BITMAP), &bm))
19 | return;
20 |
21 | HDC tmp = CreateCompatibleDC(NULL);
22 | HBITMAP oldBmp = (HBITMAP)SelectObject(tmp, icon);
23 |
24 | RECT rect = { this->rect.left + (settings.itemWidth - settings.iconWidth) / 2, settings.topMargin };
25 | rect.right = rect.left + settings.iconWidth;
26 | rect.bottom = rect.top + settings.iconHeight;
27 | BLENDFUNCTION bf;
28 | bf.AlphaFormat = AC_SRC_ALPHA;
29 | bf.BlendFlags = 0;
30 | bf.BlendOp = AC_SRC_OVER;
31 | bf.SourceConstantAlpha = flags & IF_GHOST ? 160 : 255;
32 | if(flags & IF_SMALL)
33 | AlphaBlend(dest, rect.left, rect.top + settings.iconHeight / 2, settings.iconWidth / 2, settings.iconHeight / 2, tmp, 0, 0, bm.bmWidth, bm.bmHeight, bf);
34 | else
35 | AlphaBlend(dest, rect.left, rect.top, settings.iconWidth, settings.iconHeight, tmp, 0, 0, bm.bmWidth, bm.bmHeight, bf);
36 |
37 | bf.SourceConstantAlpha = 120;
38 | int iconHeight = flags & IF_SMALL ? (settings.iconHeight / 2) : settings.iconHeight;
39 | for(int y = rect.top + iconHeight; y < settings.barHeight - settings.bottomMargin; ++y)
40 | {
41 | int yLine = iconHeight - (y - (rect.top + iconHeight)) - 1;
42 | if(yLine < 0)
43 | break;
44 | if(iconHeight != bm.bmHeight)
45 | yLine = int(float(yLine) * float(bm.bmHeight) / float(iconHeight));
46 | AlphaBlend(dest, rect.left, y + (flags & IF_SMALL ? (settings.iconHeight / 2) : 0), flags & IF_SMALL ? (settings.iconWidth / 2) : settings.iconWidth, 1, tmp, 0, yLine, bm.bmWidth, 1, bf);
47 | bf.SourceConstantAlpha -= 8;
48 | if(bf.SourceConstantAlpha == 0)
49 | break;
50 | }
51 |
52 | SelectObject(tmp, oldBmp);
53 | DeleteDC(tmp);
54 | }
--------------------------------------------------------------------------------
/libnstd.vcxproj.filters:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/Src/Dock/Storage.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | class Storage
5 | {
6 | public:
7 | Storage();
8 | ~Storage();
9 |
10 | Storage* getCurrentStorage();
11 | void_t setCurrentStorage(Storage* storage);
12 |
13 | bool_t enterSection(const String& name);
14 | bool_t enterNumSection(uint_t pos);
15 | Storage* getSection(const String& name);
16 | Storage* getNumSection(uint_t pos);
17 |
18 | bool_t deleteSection(const String& name);
19 | bool_t deleteNumSection(uint_t pos);
20 |
21 | bool_t swapNumSections(uint_t pos1, uint_t pos2);
22 |
23 | uint_t getNumSectionCount() const;
24 | bool_t setNumSectionCount(uint_t size);
25 |
26 | bool_t leave();
27 |
28 | const String& getStr(const String& name, const String& default = String()) const;
29 | int_t getInt(const String& name, int default) const;
30 | uint_t getUInt(const String& name, uint_t default) const;
31 | bool_t getData(const String& name, const void_t*& data, uint_t& length, const void_t* defaultData, uint_t defaultLength) const;
32 | bool_t setStr(const String& name, const String& value);
33 | bool_t setInt(const String& name, int_t value);
34 | bool_t setUInt(const String& name, uint_t value);
35 | bool_t setData(const String& name, const void_t* data, uint_t length);
36 | bool_t deleteEntry(const String& name);
37 |
38 | bool_t save();
39 | bool_t load(const String& file);
40 |
41 | private:
42 | class Data
43 | {
44 | public:
45 | void_t* data;
46 | uint_t length;
47 | Data(const void_t* data, uint_t length);
48 | Data() : data(0), length(0) {};
49 | ~Data();
50 | };
51 |
52 | class Variant
53 | {
54 | public:
55 | enum Type
56 | {
57 | Null,
58 | Str,
59 | Int,
60 | UInt,
61 | Data,
62 | };
63 |
64 | Type type;
65 | union
66 | {
67 | int_t _int;
68 | uint_t _uint;
69 | String* str;
70 | Storage::Data* data;
71 | };
72 |
73 | Variant();
74 | ~Variant();
75 | void free();
76 | Variant& operator=(const Variant& other);
77 | };
78 |
79 | String filename;
80 | HashMap entries;
81 | HashMap storages;
82 | Array array;
83 | Storage* current;
84 | Storage* parent;
85 |
86 | Storage(Storage* parent);
87 |
88 | void_t clear();
89 |
90 | bool_t load(File& file);
91 | bool_t save(File& file) const;
92 |
93 | static bool_t read(File& file, void_t* buffer, uint_t size);
94 | static bool_t write(File& file, const void_t* buffer, uint_t size);
95 | };
96 |
--------------------------------------------------------------------------------
/Src/Dock2.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Bdock2 plugin api.
3 | * @author Colin Graf
4 | */
5 |
6 | #pragma once
7 |
8 | #ifdef __cplusplus
9 | extern "C"
10 | {
11 | #endif
12 |
13 | struct Icon;
14 | struct Timer;
15 | struct Plugin;
16 |
17 | struct Icon
18 | {
19 | HBITMAP icon;
20 | unsigned int flags;
21 | int (*handleMouseEvent)(struct Icon* icon, unsigned int message, int x, int y);
22 | int (*handleMoveEvent)(struct Icon* icon);
23 | void* userData;
24 | };
25 |
26 | #define IF_GHOST 0x01
27 | #define IF_ACTIVE 0x02
28 | #define IF_SMALL 0x04
29 | #define IF_HALFBG 0x08 // TODO: remove this?
30 | #define IF_FULLBG 0x10 // TODO: remove this?
31 | #define IF_HOT 0x20
32 |
33 | struct Timer
34 | {
35 | unsigned int interval;
36 | int (*handleTimerEvent)(struct Timer* timer);
37 | void* userData;
38 | };
39 |
40 | struct Dock
41 | {
42 | struct Icon* (*createIcon)(HBITMAP icon, unsigned int flags);
43 | int (*destroyIcon)(struct Icon* icon);
44 | int (*updateIcon)(struct Icon* icon);
45 | int (*updateIcons)(struct Icon** icons, unsigned int count);
46 | int (*getIconRect)(struct Icon* icon, RECT* rect);
47 |
48 | struct Icon* (*getFirstIcon)();
49 | struct Icon* (*getLastIcon)();
50 | struct Icon* (*getNextIcon)(struct Icon* icon);
51 | struct Icon* (*getPreviousIcon)(struct Icon* icon);
52 |
53 | DWORD (*showMenu)(HMENU hmenu, int x, int y);
54 |
55 | struct Timer* (*createTimer)(unsigned int interval);
56 | int (*updateTimer)(struct Timer* timer);
57 | int (*destroyTimer)(struct Timer* timer);
58 |
59 | int (*enterStorageSection)(const wchar_t* name);
60 | int (*enterStorageNumSection)(unsigned int pos);
61 | int (*leaveStorageSection)();
62 |
63 | int (*deleteStorageSection)(const wchar_t* name);
64 | int (*deleteStorageNumSection)(unsigned int pos);
65 | int (*swapStorageNumSections)(unsigned int pos1, unsigned int pos2);
66 |
67 | unsigned int (*getStorageNumSectionCount)();
68 | int (*setStorageNumSectionCount)(unsigned int count);
69 |
70 | const wchar_t* (*getStorageString)(const wchar_t* name, unsigned int* length, const wchar_t* default, unsigned int defaultLength);
71 | int (*getStorageInt)(const wchar_t* name, int default);
72 | unsigned int (*getStorageUInt)(const wchar_t* name, unsigned int default);
73 | int (*getStorageData)(const wchar_t* name, const void** data, unsigned int* length, const void* defaultData, unsigned int defaultLength);
74 | int (*setStorageString)(const wchar_t* name, const wchar_t* value, unsigned int length);
75 | int (*setStorageInt)(const wchar_t* name, int value);
76 | int (*setStorageUInt)(const wchar_t* name, unsigned int value);
77 | int (*setStorageData)(const wchar_t* name, char* data, unsigned int length);
78 |
79 | int (*deleteStorageEntry)(const wchar_t* name);
80 | };
81 |
82 | #ifdef __cplusplus
83 | }
84 | #endif
85 |
--------------------------------------------------------------------------------
/Src/Plugins/Clock/Clock.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 | /////////////////////////////////////////////////////////////////////////////
7 | //
8 | // Generated from the TEXTINCLUDE 2 resource.
9 | //
10 | #ifndef APSTUDIO_INVOKED
11 | #include "targetver.h"
12 | #endif
13 | #define APSTUDIO_HIDDEN_SYMBOLS
14 | #include "windows.h"
15 | #undef APSTUDIO_HIDDEN_SYMBOLS
16 |
17 | /////////////////////////////////////////////////////////////////////////////
18 | #undef APSTUDIO_READONLY_SYMBOLS
19 |
20 | /////////////////////////////////////////////////////////////////////////////
21 | // English (United States) resources
22 |
23 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
24 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
25 | #pragma code_page(1252)
26 |
27 | #ifdef APSTUDIO_INVOKED
28 | /////////////////////////////////////////////////////////////////////////////
29 | //
30 | // TEXTINCLUDE
31 | //
32 |
33 | 1 TEXTINCLUDE
34 | BEGIN
35 | "resource.h\0"
36 | END
37 |
38 | 2 TEXTINCLUDE
39 | BEGIN
40 | "#ifndef APSTUDIO_INVOKED\r\n"
41 | "#include ""targetver.h""\r\n"
42 | "#endif\r\n"
43 | "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
44 | "#include ""windows.h""\r\n"
45 | "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
46 | "\0"
47 | END
48 |
49 | 3 TEXTINCLUDE
50 | BEGIN
51 | "\r\n"
52 | "\0"
53 | END
54 |
55 | #endif // APSTUDIO_INVOKED
56 |
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 | //
60 | // Version
61 | //
62 |
63 | VS_VERSION_INFO VERSIONINFO
64 | FILEVERSION 0,4,0,0
65 | PRODUCTVERSION 0,4,0,0
66 | FILEFLAGSMASK 0x3fL
67 | #ifdef _DEBUG
68 | FILEFLAGS 0x1L
69 | #else
70 | FILEFLAGS 0x0L
71 | #endif
72 | FILEOS 0x40004L
73 | FILETYPE 0x2L
74 | FILESUBTYPE 0x0L
75 | BEGIN
76 | BLOCK "StringFileInfo"
77 | BEGIN
78 | BLOCK "040904b0"
79 | BEGIN
80 | VALUE "CompanyName", "Colin Graf"
81 | VALUE "FileDescription", "Shows a clock icon."
82 | VALUE "FileVersion", "0.4.0.0"
83 | VALUE "InternalName", "Clock.dll"
84 | VALUE "LegalCopyright", "Copyright (C) 2013"
85 | VALUE "OriginalFilename", "Clock.dll"
86 | VALUE "ProductName", "Clock"
87 | VALUE "ProductVersion", "0.4.0.0"
88 | END
89 | END
90 | BLOCK "VarFileInfo"
91 | BEGIN
92 | VALUE "Translation", 0x409, 1200
93 | END
94 | END
95 |
96 | #endif // English (United States) resources
97 | /////////////////////////////////////////////////////////////////////////////
98 |
99 |
100 |
101 | #ifndef APSTUDIO_INVOKED
102 | /////////////////////////////////////////////////////////////////////////////
103 | //
104 | // Generated from the TEXTINCLUDE 3 resource.
105 | //
106 |
107 |
108 | /////////////////////////////////////////////////////////////////////////////
109 | #endif // not APSTUDIO_INVOKED
110 |
111 |
--------------------------------------------------------------------------------
/Src/Plugins/SystemTray/SystemTray.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 | /////////////////////////////////////////////////////////////////////////////
7 | //
8 | // Generated from the TEXTINCLUDE 2 resource.
9 | //
10 | #ifndef APSTUDIO_INVOKED
11 | #include "targetver.h"
12 | #endif
13 | #define APSTUDIO_HIDDEN_SYMBOLS
14 | #include "windows.h"
15 | #undef APSTUDIO_HIDDEN_SYMBOLS
16 |
17 | /////////////////////////////////////////////////////////////////////////////
18 | #undef APSTUDIO_READONLY_SYMBOLS
19 |
20 | /////////////////////////////////////////////////////////////////////////////
21 | // English (United States) resources
22 |
23 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
24 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
25 | #pragma code_page(1252)
26 |
27 | #ifdef APSTUDIO_INVOKED
28 | /////////////////////////////////////////////////////////////////////////////
29 | //
30 | // TEXTINCLUDE
31 | //
32 |
33 | 1 TEXTINCLUDE
34 | BEGIN
35 | "resource.h\0"
36 | END
37 |
38 | 2 TEXTINCLUDE
39 | BEGIN
40 | "#ifndef APSTUDIO_INVOKED\r\n"
41 | "#include ""targetver.h""\r\n"
42 | "#endif\r\n"
43 | "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
44 | "#include ""windows.h""\r\n"
45 | "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
46 | "\0"
47 | END
48 |
49 | 3 TEXTINCLUDE
50 | BEGIN
51 | "\r\n"
52 | "\0"
53 | END
54 |
55 | #endif // APSTUDIO_INVOKED
56 |
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 | //
60 | // Version
61 | //
62 |
63 | VS_VERSION_INFO VERSIONINFO
64 | FILEVERSION 0,4,0,0
65 | PRODUCTVERSION 0,4,0,0
66 | FILEFLAGSMASK 0x3fL
67 | #ifdef _DEBUG
68 | FILEFLAGS 0x1L
69 | #else
70 | FILEFLAGS 0x0L
71 | #endif
72 | FILEOS 0x40004L
73 | FILETYPE 0x2L
74 | FILESUBTYPE 0x0L
75 | BEGIN
76 | BLOCK "StringFileInfo"
77 | BEGIN
78 | BLOCK "040904b0"
79 | BEGIN
80 | VALUE "CompanyName", "Colin Graf"
81 | VALUE "FileDescription", "Shows system tray icons."
82 | VALUE "FileVersion", "0.4.0.0"
83 | VALUE "InternalName", "SystemTray.dll"
84 | VALUE "LegalCopyright", "Copyright (C) 2013"
85 | VALUE "OriginalFilename", "SystemTray.dll"
86 | VALUE "ProductName", "SystemTray"
87 | VALUE "ProductVersion", "0.4.0.0"
88 | END
89 | END
90 | BLOCK "VarFileInfo"
91 | BEGIN
92 | VALUE "Translation", 0x409, 1200
93 | END
94 | END
95 |
96 | #endif // English (United States) resources
97 | /////////////////////////////////////////////////////////////////////////////
98 |
99 |
100 |
101 | #ifndef APSTUDIO_INVOKED
102 | /////////////////////////////////////////////////////////////////////////////
103 | //
104 | // Generated from the TEXTINCLUDE 3 resource.
105 | //
106 |
107 |
108 | /////////////////////////////////////////////////////////////////////////////
109 | #endif // not APSTUDIO_INVOKED
110 |
111 |
--------------------------------------------------------------------------------
/Src/Plugins/HideTaskbar/HideTaskbar.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 | /////////////////////////////////////////////////////////////////////////////
7 | //
8 | // Generated from the TEXTINCLUDE 2 resource.
9 | //
10 | #ifndef APSTUDIO_INVOKED
11 | #include "targetver.h"
12 | #endif
13 | #define APSTUDIO_HIDDEN_SYMBOLS
14 | #include "windows.h"
15 | #undef APSTUDIO_HIDDEN_SYMBOLS
16 |
17 | /////////////////////////////////////////////////////////////////////////////
18 | #undef APSTUDIO_READONLY_SYMBOLS
19 |
20 | /////////////////////////////////////////////////////////////////////////////
21 | // English (United States) resources
22 |
23 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
24 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
25 | #pragma code_page(1252)
26 |
27 | #ifdef APSTUDIO_INVOKED
28 | /////////////////////////////////////////////////////////////////////////////
29 | //
30 | // TEXTINCLUDE
31 | //
32 |
33 | 1 TEXTINCLUDE
34 | BEGIN
35 | "resource.h\0"
36 | END
37 |
38 | 2 TEXTINCLUDE
39 | BEGIN
40 | "#ifndef APSTUDIO_INVOKED\r\n"
41 | "#include ""targetver.h""\r\n"
42 | "#endif\r\n"
43 | "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
44 | "#include ""windows.h""\r\n"
45 | "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
46 | "\0"
47 | END
48 |
49 | 3 TEXTINCLUDE
50 | BEGIN
51 | "\r\n"
52 | "\0"
53 | END
54 |
55 | #endif // APSTUDIO_INVOKED
56 |
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 | //
60 | // Version
61 | //
62 |
63 | VS_VERSION_INFO VERSIONINFO
64 | FILEVERSION 0,4,0,0
65 | PRODUCTVERSION 0,4,0,0
66 | FILEFLAGSMASK 0x3fL
67 | #ifdef _DEBUG
68 | FILEFLAGS 0x1L
69 | #else
70 | FILEFLAGS 0x0L
71 | #endif
72 | FILEOS 0x40004L
73 | FILETYPE 0x2L
74 | FILESUBTYPE 0x0L
75 | BEGIN
76 | BLOCK "StringFileInfo"
77 | BEGIN
78 | BLOCK "040904b0"
79 | BEGIN
80 | VALUE "CompanyName", "Colin Graf"
81 | VALUE "FileDescription", "Removes the windows taskbar from the desktop."
82 | VALUE "FileVersion", "0.4.0.0"
83 | VALUE "InternalName", "HideTaskbar.dll"
84 | VALUE "LegalCopyright", "Copyright (C) 2013"
85 | VALUE "OriginalFilename", "HideTaskbar.dll"
86 | VALUE "ProductName", "HideTaskbar"
87 | VALUE "ProductVersion", "0.4.0.0"
88 | END
89 | END
90 | BLOCK "VarFileInfo"
91 | BEGIN
92 | VALUE "Translation", 0x409, 1200
93 | END
94 | END
95 |
96 | #endif // English (United States) resources
97 | /////////////////////////////////////////////////////////////////////////////
98 |
99 |
100 |
101 | #ifndef APSTUDIO_INVOKED
102 | /////////////////////////////////////////////////////////////////////////////
103 | //
104 | // Generated from the TEXTINCLUDE 3 resource.
105 | //
106 |
107 |
108 | /////////////////////////////////////////////////////////////////////////////
109 | #endif // not APSTUDIO_INVOKED
110 |
111 |
--------------------------------------------------------------------------------
/Marefile:
--------------------------------------------------------------------------------
1 |
2 | platforms = { "Win32", "x64" }
3 | configurations = { "Debug", "Release" }
4 |
5 | defines = { "UNICODE", "_UNICODE", "_WIN32" }
6 | if configuration == "Debug" {
7 | defines += { "DEBUG", "_DEBUG" }
8 | }
9 | if configuration == "Release" {
10 | defines += { "NDEBUG" }
11 | cppFlags += { "/MT" }
12 | }
13 | if platform == "x64" {
14 | defines += { "_WIN64" }
15 | }
16 |
17 | plugins = { "Launcher", "Clock", "HideTaskbar", "SystemTray" }
18 |
19 | targets = {
20 |
21 | Dock = cppApplication + {
22 | dependencies = plugins + { "libnstd", "libWinAPI" }
23 | buildDir = "Build/$(configuration)_$(platform)"
24 | output = "Build/$(configuration)_$(platform)/BDock.exe"
25 | cppFlags += { "/Yu" }
26 | linkFlags += { "\"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'\"" }
27 | includePaths = { "Ext/libnstd/include", "Ext/libWinAPI/include" }
28 | libPaths = { "Build/$(configuration)_$(platform)/libnstd", "Build/$(configuration)_$(platform)/libWinAPI" }
29 | libs = { "Msimg32", "nstd", "WinAPI" }
30 | root = { "Src/Dock", "Src" }
31 | files = {
32 | "Src/Dock/**.cpp" = cppSource
33 | "Src/Dock/stdafx.cpp" = cppSource + {
34 | cppFlags += { "/Yc" }
35 | }
36 | "Src/Dock/**.h"
37 | "Src/Dock/**.rc" = rcSource
38 | "Src/Dock/*.ico"
39 | "Src/Dock2.h"
40 | }
41 | }
42 |
43 | "$(plugins)" = cppDynamicLibrary + {
44 | dependencies = { "libnstd", "libWinAPI" }
45 | buildDir = "Build/$(configuration)_$(platform)/$(target)"
46 | output = "Build/$(configuration)_$(platform)/$(target).dll"
47 | folder = "Plugins"
48 | includePaths = { "Ext/libnstd/include", "Ext/libWinAPI/include" }
49 | libPaths = { "Build/$(configuration)_$(platform)/libnstd", "Build/$(configuration)_$(platform)/libWinAPI" }
50 | libs = { "nstd", "WinAPI" }
51 | root = { "Src/Plugins/$(target)", "Src" }
52 | cppFlags += { "/Yu" }
53 | files = {
54 | "Src/Plugins/$(target)/**.cpp" = cppSource
55 | "Src/Plugins/$(target)/stdafx.cpp" = cppSource + {
56 | cppFlags += { "/Yc" }
57 | }
58 | "Src/Plugins/$(target)/**.h"
59 | "Src/Plugins/$(target)/**.rc" = rcSource
60 | "Src/Dock2.h"
61 | }
62 | }
63 |
64 | libnstd = cppStaticLibrary + {
65 | folder = "Libraries"
66 | includePaths = { "Ext/libnstd/include" }
67 | buildDir = "Build/$(configuration)_$(platform)/$(target)"
68 | defines += { "_CRT_SECURE_NO_WARNINGS" }
69 | root = { "Ext/libnstd/src", "Ext/libnstd/include/nstd" }
70 | files = {
71 | "Ext/libnstd/src/*.cpp" = cppSource,
72 | "Ext/libnstd/include/nstd/*.h"
73 | }
74 | }
75 |
76 | libWinAPI = cppStaticLibrary + {
77 | folder = "Libraries"
78 | includePaths = { "Ext/libWinAPI/include" }
79 | buildDir = "Build/$(configuration)_$(platform)/$(target)"
80 | //defines += { "_CRT_SECURE_NO_WARNINGS" }
81 | root = { "Ext/libWinAPI/src", "Ext/libWinAPI/include" }
82 | files = {
83 | "Ext/libWinAPI/src/*.cpp" = cppSource,
84 | "Ext/libWinAPI/include/*.h"
85 | }
86 | }
87 | }
88 |
89 |
--------------------------------------------------------------------------------
/Src/Plugins/Launcher/Launcher.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 | /////////////////////////////////////////////////////////////////////////////
7 | //
8 | // Generated from the TEXTINCLUDE 2 resource.
9 | //
10 | #ifndef APSTUDIO_INVOKED
11 | #include "targetver.h"
12 | #endif
13 | #define APSTUDIO_HIDDEN_SYMBOLS
14 | #include "windows.h"
15 | #undef APSTUDIO_HIDDEN_SYMBOLS
16 |
17 | /////////////////////////////////////////////////////////////////////////////
18 | #undef APSTUDIO_READONLY_SYMBOLS
19 |
20 | /////////////////////////////////////////////////////////////////////////////
21 | // English (United States) resources
22 |
23 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
24 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
25 | #pragma code_page(1252)
26 |
27 | #ifdef APSTUDIO_INVOKED
28 | /////////////////////////////////////////////////////////////////////////////
29 | //
30 | // TEXTINCLUDE
31 | //
32 |
33 | 1 TEXTINCLUDE
34 | BEGIN
35 | "resource.h\0"
36 | END
37 |
38 | 2 TEXTINCLUDE
39 | BEGIN
40 | "#ifndef APSTUDIO_INVOKED\r\n"
41 | "#include ""targetver.h""\r\n"
42 | "#endif\r\n"
43 | "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
44 | "#include ""windows.h""\r\n"
45 | "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
46 | "\0"
47 | END
48 |
49 | 3 TEXTINCLUDE
50 | BEGIN
51 | "\r\n"
52 | "\0"
53 | END
54 |
55 | #endif // APSTUDIO_INVOKED
56 |
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 | //
60 | // Version
61 | //
62 |
63 | VS_VERSION_INFO VERSIONINFO
64 | FILEVERSION 0,4,0,0
65 | PRODUCTVERSION 0,4,0,0
66 | FILEFLAGSMASK 0x3fL
67 | #ifdef _DEBUG
68 | FILEFLAGS 0x1L
69 | #else
70 | FILEFLAGS 0x0L
71 | #endif
72 | FILEOS 0x40004L
73 | FILETYPE 0x2L
74 | FILESUBTYPE 0x0L
75 | BEGIN
76 | BLOCK "StringFileInfo"
77 | BEGIN
78 | BLOCK "040904b0"
79 | BEGIN
80 | VALUE "CompanyName", "Colin Graf"
81 | VALUE "FileDescription", "Shows application launch and window switcher icons."
82 | VALUE "FileVersion", "0.4.0.0"
83 | VALUE "InternalName", "Launcher.dll"
84 | VALUE "LegalCopyright", "Copyright (C) 2013"
85 | VALUE "OriginalFilename", "Launcher.dll"
86 | VALUE "ProductName", "Launcher"
87 | VALUE "ProductVersion", "0.4.0.0"
88 | END
89 | END
90 | BLOCK "VarFileInfo"
91 | BEGIN
92 | VALUE "Translation", 0x409, 1200
93 | END
94 | END
95 |
96 |
97 | /////////////////////////////////////////////////////////////////////////////
98 | //
99 | // String Table
100 | //
101 |
102 | STRINGTABLE
103 | BEGIN
104 | IDS_PIN "&Pin To Dock"
105 | IDS_UNPIN "Un&pin From Dock"
106 | IDS_LAUNCH "&Launch"
107 | END
108 |
109 | #endif // English (United States) resources
110 | /////////////////////////////////////////////////////////////////////////////
111 |
112 |
113 |
114 | #ifndef APSTUDIO_INVOKED
115 | /////////////////////////////////////////////////////////////////////////////
116 | //
117 | // Generated from the TEXTINCLUDE 3 resource.
118 | //
119 |
120 |
121 | /////////////////////////////////////////////////////////////////////////////
122 | #endif // not APSTUDIO_INVOKED
123 |
124 |
--------------------------------------------------------------------------------
/Src/Dock/Plugin.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | class Icon;
5 | class Dock;
6 |
7 | class Plugin
8 | {
9 | public:
10 | static Plugin* lookup(void_t* returnAddress);
11 |
12 | Dock& dock;
13 | Storage& storage;
14 |
15 | Plugin(Dock& dock, Storage& storage);
16 | ~Plugin();
17 |
18 | bool_t init(const String& name);
19 |
20 | void_t swapIcons(Icon* icon1, Icon* icon2);
21 |
22 | // api functions
23 | API::Icon* createIcon(HBITMAP icon, uint_t flags);
24 | bool_t destroyIcon(API::Icon* icon);
25 | bool_t updateIcon(API::Icon* icon);
26 | bool_t updateIcons(API::Icon** icons, uint_t count);
27 | bool_t getIconRect(API::Icon* icon, RECT* rect);
28 | API::Icon* getFirstIcon();
29 | API::Icon* getLastIcon();
30 | API::Icon* getNextIcon(API::Icon* icon);
31 | API::Icon* getPreviousIcon(API::Icon* icon);
32 | API::Timer* createTimer(uint_t interval);
33 | bool_t updateTimer(API::Timer* timer);
34 | bool_t destroyTimer(API::Timer* timer);
35 |
36 | private:
37 | static HashMap plugins;
38 |
39 | API::Dock dockAPI;
40 | API::Plugin* plugin;
41 | HMODULE hmodule;
42 | HashSet icons;
43 | HashSet timers;
44 |
45 | void_t addIcon(Icon* icon);
46 | void_t removeIcon(Icon* icon);
47 | void_t deleteIcon(Icon* icon);
48 |
49 | void_t addTimer(Timer* timer) { timers.append(timer); }
50 | void_t removeTimer(Timer* timer) { timers.remove(timer); }
51 | void_t deleteTimer(Timer* timer);
52 |
53 | struct Interface
54 | {
55 | static API::Icon* createIcon(HBITMAP icon, unsigned int flags);
56 | static int destroyIcon(API::Icon* icon);
57 | static int updateIcon(API::Icon* icon);
58 | static int updateIcons(API::Icon** icons, uint_t count);
59 | static int getIconRect(API::Icon* icon, RECT* rect);
60 | static API::Icon* getFirstIcon();
61 | static API::Icon* getLastIcon();
62 | static API::Icon* getNextIcon(API::Icon* icon);
63 | static API::Icon* getPreviousIcon(API::Icon* icon);
64 | static DWORD showMenu(HMENU hmenu, int x, int y);
65 | static struct API::Timer* createTimer(unsigned int interval);
66 | static int updateTimer(struct API::Timer* timer);
67 | static int destroyTimer(struct API::Timer* timer);
68 | static int enterStorageSection(const wchar_t* name);
69 | static int enterStorageNumSection(unsigned int pos);
70 | static int leaveStorageSection();
71 | static int deleteStorageSection(const wchar_t* name);
72 | static int deleteStorageNumSection(uint_t pos);
73 | static int swapStorageNumSections(unsigned int pos1, unsigned int pos2);
74 | static unsigned int getStorageNumSectionCount();
75 | static int setStorageNumSectionCount(unsigned int count);
76 | static const wchar_t* getStorageString(const wchar_t* name, unsigned int* length, const wchar_t* default, unsigned int defaultLength);
77 | static int getStorageInt(const wchar_t* name, int default);
78 | static unsigned int getStorageUInt(const wchar_t* name, unsigned int default);
79 | static int getStorageData(const wchar_t* name, const void** data, unsigned int* length, const void* defaultData, unsigned int defaultLength);
80 | static int setStorageString(const wchar_t* name, const wchar_t* value, unsigned int length);
81 | static int setStorageInt(const wchar_t* name, int value);
82 | static int setStorageUInt(const wchar_t* name, unsigned int value);
83 | static int setStorageData(const wchar_t* name, char* data, unsigned int length);
84 | static int deleteStorageEntry(const wchar_t* name);
85 | };
86 | };
87 |
--------------------------------------------------------------------------------
/Src/Plugins/Clock/Clock.cpp:
--------------------------------------------------------------------------------
1 | // HideTaskBar.cpp : Defines the exported functions for the DLL application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 |
7 | Clock::Clock(Dock& dock) : dock(dock), bitmap(0), font(0), bgBrush(0), icon(0), timer(0) {}
8 |
9 | Clock::~Clock()
10 | {
11 | if(bitmap)
12 | DeleteObject(bitmap);
13 | if(font)
14 | DeleteObject(font);
15 | if(bgBrush)
16 | DeleteObject(bgBrush);
17 | }
18 |
19 | bool Clock::init()
20 | {
21 | // create dib bitmap
22 | BITMAPINFO bi;
23 | memset(&bi, 0, sizeof(BITMAPINFOHEADER));
24 |
25 | bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
26 | bi.bmiHeader.biWidth = 32;
27 | bi.bmiHeader.biHeight = -32; // negative --> top-down DIB
28 | bi.bmiHeader.biPlanes = 1;
29 | bi.bmiHeader.biBitCount = 32;
30 | bi.bmiHeader.biCompression = BI_RGB;
31 |
32 | HDC hdc = CreateCompatibleDC(NULL);
33 | bitmap = CreateDIBSection(hdc, &bi, DIB_RGB_COLORS, (void**)&bitmapData, NULL, 0);
34 | DeleteDC(hdc);
35 | if(!bitmap)
36 | return false;
37 |
38 | // create font
39 | NONCLIENTMETRICS ncm;
40 | ncm.cbSize = sizeof(NONCLIENTMETRICS);
41 | SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0);
42 | ncm.lfMessageFont.lfQuality = ANTIALIASED_QUALITY;
43 | font = CreateFontIndirect(&ncm.lfMessageFont);
44 | if(!font)
45 | return false;
46 | textColor = 0xffffff; //GetSysColor(COLOR_WINDOWTEXT);
47 |
48 | // create bg brush
49 | bgBrush = CreateSolidBrush(0);
50 | if(!bgBrush)
51 | return false;
52 |
53 | // draw clock
54 | update();
55 |
56 | // add clock icon to dock
57 | //createIcon(this, 0, IF_SMALL);
58 | icon = dock.createIcon(bitmap, IF_HALFBG);
59 | if(!icon)
60 | return false;
61 |
62 | // add update timer
63 | timer = dock.createTimer(60 * 1000 - st.wSecond * 1000 - st.wMilliseconds);
64 | if(!timer)
65 | return false;
66 | timer->handleTimerEvent = handleTimerEvent;
67 | timer->userData = this;
68 |
69 | return true;
70 | }
71 |
72 | int Clock::handleTimerEvent(Timer* timer)
73 | {
74 | Clock* clock = (Clock*) timer->userData;
75 | clock->update();
76 | clock->dock.updateIcon(clock->icon);
77 | timer->interval = 60 * 1000 - clock->st.wSecond * 1000 - clock->st.wMilliseconds;
78 | clock->dock.updateTimer(timer);
79 | return 0;
80 | }
81 |
82 | void Clock::update()
83 | {
84 | HDC dest = CreateCompatibleDC(NULL);
85 | HBITMAP oldBmp = (HBITMAP)SelectObject(dest, bitmap);
86 | HFONT oldFont = (HFONT)SelectObject(dest, font);
87 | SetBkMode(dest, OPAQUE);
88 | SetBkColor(dest, (~textColor) & 0xffffff);
89 | SetTextColor(dest, textColor);
90 |
91 |
92 | RECT rc = { 0, 0, 32, 32 };
93 | FillRect(dest, &rc, bgBrush);
94 |
95 | GetLocalTime(&st);
96 | wchar_t time[32];
97 | swprintf_s(time, L"%02u:%02u", st.wHour, st.wMinute);
98 |
99 | DrawText(dest, time, 5, &rc, DT_SINGLELINE | DT_CALCRECT);
100 |
101 | int height = rc.bottom - rc.top;
102 | rc.top = 16 + (16 - height) / 2;
103 | rc.bottom = rc.top + height;
104 | int width = rc.right - rc.left;
105 | rc.left = (32 - width) / 2;
106 | rc.right = rc.left + width;
107 | DrawText(dest, time, 5, &rc, DT_SINGLELINE);
108 |
109 | SelectObject(dest, oldBmp);
110 | SelectObject(dest, oldFont);
111 | DeleteDC(dest);
112 |
113 |
114 | COLORREF bgColor = (~textColor) & 0xffffff;
115 | for(int i = rc.top, end = rc.bottom; i < end; ++i)
116 | {
117 | COLORREF* pos = bitmapData + i * 32 + rc.left;
118 | COLORREF* bmEnd = pos + width;
119 | for(; pos < bmEnd; ++pos)
120 | {
121 | if((*pos & 0xffffff) == bgColor)
122 | *pos = 0x00000000;
123 | else
124 | {
125 | //tmp = *pos & 0xff | (*pos >> 8) & 0xff | (*pos >> 16) & 0xff;
126 |
127 | //*pos |= ((*pos & 0xff) << 24) | 0xaaaaaa;
128 | *pos |= 0xff000000;
129 | //*pos |= tmp << 24;
130 | }
131 | }
132 | }
133 | }
134 |
135 |
--------------------------------------------------------------------------------
/Src/Dock/Skin.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | Skin::Bitmap::Bitmap() : bmp(0) {}
5 |
6 | Skin::Bitmap::~Bitmap()
7 | {
8 | if(bmp)
9 | DeleteObject(bmp);
10 | }
11 |
12 | bool Skin::Bitmap::load(const wchar_t* file)
13 | {
14 | ASSERT(!bmp);
15 | bmp = (HBITMAP) LoadImage(NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
16 | if(!bmp)
17 | return false;
18 |
19 | BITMAP bm;
20 | ::GetObject(bmp, sizeof( bm ), &bm);
21 | size.cx = bm.bmWidth;
22 | size.cy = bm.bmHeight;
23 | return true;
24 | }
25 |
26 |
27 | void Skin::Bitmap::draw(HDC dest, int x, int y) const
28 | {
29 | HDC tmp = CreateCompatibleDC(NULL);
30 | HBITMAP oldBmp = (HBITMAP)SelectObject(tmp, bmp);
31 |
32 | BLENDFUNCTION bf;
33 | bf.AlphaFormat = AC_SRC_ALPHA;
34 | bf.BlendFlags = 0;
35 | bf.BlendOp = AC_SRC_OVER;
36 | bf.SourceConstantAlpha = 160;
37 | AlphaBlend(dest, x, y, size.cx, size.cy, tmp, 0, 0, size.cx, size.cy, bf);
38 |
39 | SelectObject(tmp, oldBmp);
40 | DeleteDC(tmp);
41 | }
42 |
43 | Skin::Skin() : bgBrush(CreateSolidBrush(0)), bg(0) {}
44 |
45 | Skin::~Skin()
46 | {
47 | if(bgBrush)
48 | DeleteObject(bgBrush);
49 | if(bg)
50 | DeleteObject(bg);
51 | }
52 |
53 | bool Skin::init(const String& name)
54 | {
55 | String file(_T("Skins/"));
56 | file += name;
57 | file += _T('/');
58 | size_t flen = file.length();
59 |
60 | file.resize(flen);
61 | file += _T("leftBg.bmp");
62 | leftBg.load(file);
63 |
64 | file.resize(flen);
65 | file += _T("rightBg.bmp");
66 | rightBg.load(file);
67 |
68 | file.resize(flen);
69 | file += _T("midBg.bmp");
70 | midBg.load(file);
71 |
72 | file.resize(flen);
73 | file += _T("activeBg.bmp");
74 | activeBg.load(file);
75 |
76 | file.resize(flen);
77 | file += _T("defaultBg.bmp");
78 | defaultBg.load(file);
79 |
80 | file.resize(flen);
81 | file += _T("hotBg.bmp");
82 | hotBg.load(file);
83 |
84 | file.resize(flen);
85 | file += _T("fullBg.bmp");
86 | fullBg.load(file);
87 |
88 | file.resize(flen);
89 | file += _T("halfBg.bmp");
90 | halfBg.load(file);
91 |
92 | return true;
93 | }
94 |
95 | void Skin::draw(HDC dest, const SIZE& size, const RECT& update)
96 | {
97 | FillRect(dest, &update, bgBrush);
98 |
99 | if(!leftBg.bmp || !rightBg.bmp || !midBg.bmp)
100 | return;
101 |
102 | if(!bg || size.cx != bgSize.cx || size.cy != bgSize.cy)
103 | {
104 | if(bg)
105 | DeleteObject(bg);
106 |
107 | HDC screen = GetDC(NULL);
108 | bg = CreateCompatibleBitmap(screen, size.cx, size.cy);
109 | bgSize.cx = size.cx;
110 | bgSize.cy = size.cy;
111 | HDC dest = CreateCompatibleDC(NULL);
112 | HBITMAP oldDestBmp = (HBITMAP)SelectObject(dest, bg);
113 | HDC src = CreateCompatibleDC(NULL);
114 | HBRUSH trans = CreateSolidBrush(RGB(0, 0, 0));
115 |
116 | HBITMAP oldSrcBmp = (HBITMAP)SelectObject(src, leftBg.bmp);
117 | BitBlt(dest, 0, size.cy - leftBg.size.cy, leftBg.size.cx, leftBg.size.cy, src, 0, 0, SRCCOPY);
118 | if(size.cy > leftBg.size.cy)
119 | {
120 | RECT rect = { 0, 0, leftBg.size.cx, size.cy - leftBg.size.cy};
121 | FillRect(dest, &rect, trans);
122 | }
123 |
124 | SelectObject(src, midBg.bmp);
125 | StretchBlt(dest, leftBg.size.cx, size.cy - midBg.size.cy, size.cx - leftBg.size.cx - rightBg.size.cx, midBg.size.cy,
126 | src, 0, 0, midBg.size.cx, midBg.size.cy, SRCCOPY);
127 | if(size.cy > midBg.size.cy)
128 | {
129 | RECT rect = { leftBg.size.cx, 0, size.cx - rightBg.size.cx, size.cy - midBg.size.cy};
130 | FillRect(dest, &rect, trans);
131 | }
132 |
133 | SelectObject(src, rightBg.bmp);
134 | BitBlt(dest, size.cx - rightBg.size.cx, size.cy - rightBg.size.cy, rightBg.size.cx, rightBg.size.cy, src, 0, 0, SRCCOPY);
135 | if(size.cy > rightBg.size.cy)
136 | {
137 | RECT rect = { 0, 0, size.cx - rightBg.size.cx, size.cy - rightBg.size.cy};
138 | FillRect(dest, &rect, trans);
139 | }
140 |
141 | SelectObject(dest, oldDestBmp);
142 | DeleteDC(dest);
143 | DeleteDC(screen);
144 | SelectObject(src, oldSrcBmp);
145 | DeleteDC(src);
146 | DeleteObject(trans);
147 | }
148 |
149 | HDC src = CreateCompatibleDC(NULL);
150 | HBITMAP oldBmp = (HBITMAP)SelectObject(src, bg);
151 |
152 | BitBlt(dest, update.left, update.top, update.right - update.left, update.bottom - update.top, src,
153 | update.left, update.top, SRCCOPY);
154 |
155 | SelectObject(src, oldBmp);
156 | DeleteDC(src);
157 | }
158 |
--------------------------------------------------------------------------------
/Src/Plugins/HideTaskbar/HideTaskbar.cpp:
--------------------------------------------------------------------------------
1 | // HideTaskBar.cpp : Defines the exported functions for the DLL application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | extern HMODULE hmodule;
7 |
8 | int HideTaskBar::instances = 0;
9 | bool HideTaskBar::hidden = false;
10 | LPARAM HideTaskBar::originalState;
11 |
12 | ATOM HideTaskBar::wndClass = 0;
13 | HWND HideTaskBar::hwnd = 0;
14 |
15 | HideTaskBar::HideTaskBar()
16 | {
17 | ++instances;
18 | }
19 |
20 | bool HideTaskBar::init()
21 | {
22 | if(!hidden)
23 | {
24 | if(!showTaskBar(false, originalState))
25 | return false;
26 | hidden = true;
27 | }
28 |
29 | if(!hwnd)
30 | {
31 | // register system menu monitor window class
32 | if(!wndClass)
33 | {
34 | WNDCLASSEX wcex;
35 | wcex.cbSize = sizeof(WNDCLASSEX);
36 | wcex.style = 0;
37 | wcex.lpfnWndProc = wndProc;
38 | wcex.cbClsExtra = 0;
39 | wcex.cbWndExtra = 0;
40 | wcex.hInstance = hmodule;
41 | wcex.hIcon = 0;
42 | wcex.hCursor = 0;
43 | wcex.hbrBackground = 0; //(HBRUSH)(COLOR_WINDOW+1);
44 | wcex.lpszMenuName = 0; //MAKEINTRESOURCE(IDC_BDOCK);
45 | wcex.lpszClassName = L"BDOCKSysMenuMon";
46 | wcex.hIconSm = 0;
47 | wndClass = RegisterClassEx(&wcex);
48 | if(!wndClass)
49 | return false;
50 | }
51 |
52 | // create system menu monitor window
53 | hwnd = CreateWindowEx(NULL, L"BDOCKSysMenuMon", NULL, NULL, NULL, NULL, NULL, NULL, HWND_MESSAGE, NULL, hmodule, this);
54 | if(!hwnd)
55 | return false;
56 | if(!RegisterShellHookWindow(hwnd))
57 | return false;
58 | }
59 | return true;
60 | }
61 |
62 | HideTaskBar::~HideTaskBar()
63 | {
64 | --instances;
65 | if(instances == 0)
66 | {
67 | // unhide
68 | if(hidden)
69 | {
70 | showTaskBar(true, originalState);
71 | hidden = false;
72 | }
73 |
74 | // destroy system menu monitor window
75 | if(hwnd)
76 | {
77 | DeregisterShellHookWindow(hwnd);
78 | DestroyWindow(hwnd);
79 | hwnd = 0;
80 | }
81 | }
82 | }
83 |
84 | bool HideTaskBar::showTaskBar(bool show, LPARAM& state)
85 | {
86 | APPBARDATA apd = {0};
87 |
88 | apd.cbSize = sizeof(apd);
89 | apd.hWnd = FindWindow(L"Shell_TrayWnd", NULL);
90 | if(!apd.hWnd)
91 | return false;
92 |
93 | if(!show)
94 | state = SHAppBarMessage(ABM_GETSTATE, &apd);
95 | apd.lParam = state;
96 |
97 | if(!show)
98 | {
99 | apd.lParam |= ABS_AUTOHIDE;
100 | apd.lParam &= ~ABS_ALWAYSONTOP;
101 | }
102 |
103 | if(show)
104 | {
105 | ShowWindow(apd.hWnd, SW_SHOW);
106 | SetWindowRgn(apd.hWnd, 0, true);
107 | ShowWindow(FindWindow(L"Button", L"Start"), SW_SHOW);
108 |
109 | }
110 |
111 | SHAppBarMessage(ABM_SETSTATE, &apd);
112 |
113 | if(!show)
114 | {
115 | ShowWindow(apd.hWnd, SW_HIDE);
116 | HRGN rgn = CreateRectRgn(0, 0, 0, 0);
117 | SetWindowRgn(apd.hWnd, rgn, true);
118 | ShowWindow(FindWindow(L"Button", L"Start"), SW_HIDE);
119 | }
120 | return true;
121 | }
122 |
123 | LRESULT CALLBACK HideTaskBar::wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
124 | {
125 | if(message == WM_TIMER)
126 | {
127 | bool hideTaskBar = true;
128 | if(!showTaskBar(!hideTaskBar, HideTaskBar::originalState))
129 | return 0;
130 | hidden = hideTaskBar;
131 | return 0;
132 | }
133 | else
134 | {
135 | static unsigned int wm_shellhook = RegisterWindowMessage(L"SHELLHOOK");
136 | if(message == wm_shellhook)
137 | switch(wParam)
138 | {
139 | case HSHELL_RUDEAPPACTIVATED:
140 | case HSHELL_WINDOWACTIVATED:
141 | {
142 | HWND activeWnd = (HWND) lParam;
143 | bool hideTaskBar = activeWnd != 0;
144 | if(!hideTaskBar)
145 | {
146 | HWND startMenu = FindWindowExA(GetDesktopWindow(), 0, 0, "Start menu");
147 | if(!startMenu || !IsWindowVisible(startMenu))
148 | hideTaskBar = true;
149 | }
150 | if(!hideTaskBar)
151 | KillTimer(hwnd, 0);
152 | if(hideTaskBar != hidden)
153 | {
154 | if(hideTaskBar)
155 | {
156 | SetTimer(hwnd, 0, 600, 0);
157 | }
158 | else
159 | {
160 | if(!showTaskBar(!hideTaskBar, HideTaskBar::originalState))
161 | return false;
162 | hidden = hideTaskBar;
163 | }
164 | }
165 | }
166 | break;
167 | }
168 | }
169 | return DefWindowProc(hwnd, message, wParam, lParam);
170 | }
171 |
172 |
173 |
--------------------------------------------------------------------------------
/Ext/libWinAPI/include/WinAPI.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | namespace WinAPI
11 | {
12 | class Application
13 | {
14 | public:
15 | Application(HINSTANCE hinstance, DWORD dwICC = ICC_WIN95_CLASSES);
16 |
17 | static void setModule(HMODULE hmodule);
18 | static HINSTANCE getInstance() {return hinstance;}
19 | static void quit(UINT exitCode);
20 |
21 | UINT run();
22 |
23 | private:
24 | static HINSTANCE hinstance;
25 | };
26 |
27 | class Shell
28 | {
29 | public:
30 | static bool getFolderPath(INT folder, LPTSTR path, UINT size);
31 | static bool createLink(LPCTSTR file, LPCTSTR link, LPCTSTR description, LPCTSTR workingDir);
32 |
33 | static HINSTANCE execute(HWND hwnd, LPCTSTR lpOperation, LPCTSTR lpFile, LPCTSTR lpParameters,
34 | LPCTSTR lpDirectory, INT nShowCmd);
35 | };
36 |
37 | class String
38 | {
39 | public:
40 | String() : data(0), buffer(0) {}
41 | String(UINT stringId);
42 | ~String();
43 |
44 | operator LPCTSTR() {return data;}
45 |
46 | private:
47 | LPCTSTR data;
48 | LPTSTR buffer;
49 | };
50 |
51 | class Icon
52 | {
53 | public:
54 |
55 | Icon() : hicon(0) {}
56 | Icon(LPCTSTR icon);
57 | Icon(UINT iconId);
58 | Icon(HINSTANCE hinst, UINT iconId);
59 |
60 | operator HICON() {return hicon;}
61 |
62 | private:
63 | HICON hicon;
64 | };
65 |
66 | class Cursor
67 | {
68 | public:
69 | Cursor() : hcursor(0) {}
70 | Cursor(LPCTSTR cursor);
71 | Cursor(UINT cursorId);
72 | Cursor(HINSTANCE hinst, UINT cursorId);
73 |
74 | operator HCURSOR() {return hcursor;}
75 |
76 | private:
77 | HCURSOR hcursor;
78 | };
79 |
80 | class Menu
81 | {
82 | public:
83 | Menu() : hmenu(0) {}
84 | Menu(UINT menuId);
85 | ~Menu();
86 |
87 | private:
88 | HMENU hmenu;
89 | };
90 |
91 | class Window
92 | {
93 | public:
94 | Window() : hwnd(0) {}
95 | ~Window();
96 |
97 | bool create(LPCTSTR className, UINT windowClassStyle = CS_DBLCLKS,
98 | HWND hwndParent = NULL, HICON icon = NULL, HICON smallIcon = NULL,
99 | HCURSOR cursor = Cursor(IDC_ARROW), LPCTSTR windowName = _T(""),
100 | UINT exStyle = 0, UINT style = WS_POPUP);
101 |
102 | bool setTheme(LPCTSTR pszSubAppName, LPCTSTR pszSubIdList);
103 | bool isVisible();
104 | bool show(INT nCmdShow);
105 | bool move(INT X, INT Y, INT nWidth, INT nHeight, bool bRepaint);
106 | void setStyle(UINT style) {SetWindowLong(hwnd, GWL_STYLE, style);}
107 | UINT getStyle() const {return GetWindowLong(hwnd, GWL_STYLE);}
108 |
109 | bool registerShellHookWindow();
110 | bool deregisterShellHookWindow();
111 |
112 | bool setTimer(UINT_PTR nIDEvent, UINT uElaspe, TIMERPROC lpTimerFunc);
113 | bool killTimer(UINT_PTR nIDEvent);
114 |
115 | LRESULT sendMessage(UINT msg, WPARAM wParam, LPARAM lParam);
116 | bool postMessage(UINT msg, WPARAM wParam, LPARAM lParam);
117 |
118 | operator HWND() {return hwnd;}
119 |
120 | protected:
121 | HWND hwnd;
122 |
123 | virtual LRESULT onMessage(UINT message, WPARAM wParam, LPARAM lParam);
124 |
125 | virtual bool onCommand(UINT command, HWND source) {return false;}
126 | virtual bool onContextMenu(INT x, INT y) {return false;}
127 | };
128 |
129 | class Dialog : public Window
130 | {
131 | public:
132 | Dialog() {}
133 | ~Dialog();
134 |
135 | bool create(UINT ressourceId, HWND hwndParent);
136 | UINT show(UINT ressourceId, HWND hwndParent = NULL);
137 |
138 | bool end(UINT result);
139 |
140 | protected:
141 |
142 | virtual bool onDlgMessage(UINT message, WPARAM wParam, LPARAM lParam);
143 |
144 | virtual bool onInitDialog();
145 |
146 | virtual bool onCommand(UINT command, HWND source);
147 | };
148 |
149 | class Control : public Window
150 | {
151 | public:
152 | bool initialize(Window& parent, UINT id);
153 | };
154 |
155 | class Button : public Control
156 | {
157 | public:
158 | bool setCheck(INT check);
159 | INT getCheck();
160 | };
161 |
162 | class ImageList
163 | {
164 | public:
165 | ImageList() : himagelist(0) {}
166 | ~ImageList();
167 |
168 | bool create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow);
169 |
170 | INT add(HICON icon);
171 |
172 | operator HIMAGELIST() {return himagelist;}
173 |
174 | private:
175 | HIMAGELIST himagelist;
176 | };
177 |
178 | class ListView : public Control
179 | {
180 | public:
181 | bool setImageList(HIMAGELIST imageList, INT iImageList);
182 | INT addItem(LVITEM& item);
183 | };
184 |
185 | class TreeView : public Control
186 | {
187 | public:
188 | bool setImageList(HIMAGELIST imageList, INT iImageList);
189 | HTREEITEM insertItem(TVINSERTSTRUCT& item);
190 | };
191 |
192 | } // namespace
193 |
--------------------------------------------------------------------------------
/Src/Dock/Dock.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 | /////////////////////////////////////////////////////////////////////////////
7 | //
8 | // Generated from the TEXTINCLUDE 2 resource.
9 | //
10 | #ifndef APSTUDIO_INVOKED
11 | #include "targetver.h"
12 | #endif
13 | #define APSTUDIO_HIDDEN_SYMBOLS
14 | #include "windows.h"
15 | #undef APSTUDIO_HIDDEN_SYMBOLS
16 |
17 | /////////////////////////////////////////////////////////////////////////////
18 | #undef APSTUDIO_READONLY_SYMBOLS
19 |
20 | /////////////////////////////////////////////////////////////////////////////
21 | // English (United States) resources
22 |
23 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
24 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
25 | #pragma code_page(1252)
26 |
27 | /////////////////////////////////////////////////////////////////////////////
28 | //
29 | // Icon
30 | //
31 |
32 | // Icon with lowest ID value placed first to ensure application icon
33 | // remains consistent on all systems.
34 | IDI_BDOCK ICON "Dock.ico"
35 | IDI_SMALL ICON "Small.ico"
36 |
37 | /////////////////////////////////////////////////////////////////////////////
38 | //
39 | // Menu
40 | //
41 |
42 | IDC_BDOCK MENU
43 | BEGIN
44 | POPUP "&Dock"
45 | BEGIN
46 | MENUITEM "&Settings...", IDM_SETTINGS
47 | MENUITEM SEPARATOR
48 | MENUITEM "&About", IDM_ABOUT
49 | MENUITEM SEPARATOR
50 | MENUITEM "E&xit", IDM_EXIT
51 | END
52 | POPUP "&Help"
53 | BEGIN
54 | MENUITEM "&About ...", IDM_ABOUT
55 | END
56 | END
57 |
58 |
59 | /////////////////////////////////////////////////////////////////////////////
60 | //
61 | // Dialog
62 | //
63 |
64 | IDD_ABOUTBOX DIALOGEX 0, 0, 170, 87
65 | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
66 | CAPTION "About BDock"
67 | FONT 8, "MS Shell Dlg", 0, 0, 0x1
68 | BEGIN
69 | ICON IDI_BDOCK,IDC_STATIC,14,14,20,20
70 | LTEXT "BDock 0.3",IDC_STATIC,42,14,114,8,SS_NOPREFIX
71 | LTEXT "Copyright 2009-2013 Colin Graf",IDC_STATIC,42,26,114,8
72 | DEFPUSHBUTTON "OK",IDOK,113,66,50,14,WS_GROUP
73 | CONTROL "http://github.com/craflin/bdock",IDC_SYSLINK1,
74 | "SysLink",WS_TABSTOP,42,51,109,10
75 | LTEXT "Apache v2 License",IDC_STATIC,42,38,114,8
76 | END
77 |
78 | IDD_SETTINGS DIALOGEX 0, 0, 166, 47
79 | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
80 | CAPTION "BDock Settings"
81 | FONT 8, "MS Shell Dlg", 400, 0, 0x1
82 | BEGIN
83 | DEFPUSHBUTTON "OK",IDOK,55,26,50,14
84 | PUSHBUTTON "Cancel",IDCANCEL,109,26,50,14
85 | CONTROL "Start automatically on windows startup",IDC_AUTOSTART,
86 | "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,141,10
87 | END
88 |
89 |
90 | /////////////////////////////////////////////////////////////////////////////
91 | //
92 | // DESIGNINFO
93 | //
94 |
95 | #ifdef APSTUDIO_INVOKED
96 | GUIDELINES DESIGNINFO
97 | BEGIN
98 | IDD_ABOUTBOX, DIALOG
99 | BEGIN
100 | LEFTMARGIN, 7
101 | RIGHTMARGIN, 163
102 | TOPMARGIN, 7
103 | BOTTOMMARGIN, 80
104 | END
105 |
106 | IDD_SETTINGS, DIALOG
107 | BEGIN
108 | LEFTMARGIN, 7
109 | RIGHTMARGIN, 159
110 | TOPMARGIN, 7
111 | BOTTOMMARGIN, 40
112 | END
113 | END
114 | #endif // APSTUDIO_INVOKED
115 |
116 |
117 | #ifdef APSTUDIO_INVOKED
118 | /////////////////////////////////////////////////////////////////////////////
119 | //
120 | // TEXTINCLUDE
121 | //
122 |
123 | 1 TEXTINCLUDE
124 | BEGIN
125 | "resource.h\0"
126 | END
127 |
128 | 2 TEXTINCLUDE
129 | BEGIN
130 | "#ifndef APSTUDIO_INVOKED\r\n"
131 | "#include ""targetver.h""\r\n"
132 | "#endif\r\n"
133 | "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
134 | "#include ""windows.h""\r\n"
135 | "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
136 | "\0"
137 | END
138 |
139 | 3 TEXTINCLUDE
140 | BEGIN
141 | "\r\n"
142 | "\0"
143 | END
144 |
145 | #endif // APSTUDIO_INVOKED
146 |
147 |
148 | /////////////////////////////////////////////////////////////////////////////
149 | //
150 | // String Table
151 | //
152 |
153 | STRINGTABLE
154 | BEGIN
155 | IDS_APP_TITLE "bdock"
156 | IDS_SETTINGS_PAGE_GENERAL "General"
157 | IDC_BDOCK "BDOCK"
158 | END
159 |
160 | #endif // English (United States) resources
161 | /////////////////////////////////////////////////////////////////////////////
162 |
163 |
164 |
165 | #ifndef APSTUDIO_INVOKED
166 | /////////////////////////////////////////////////////////////////////////////
167 | //
168 | // Generated from the TEXTINCLUDE 3 resource.
169 | //
170 |
171 |
172 | /////////////////////////////////////////////////////////////////////////////
173 | #endif // not APSTUDIO_INVOKED
174 |
175 |
--------------------------------------------------------------------------------
/Src/Plugins/SystemTray/SysTools.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | // TODO: optimize this function using DIB-Bitmap!
5 | HBITMAP createBitmapFromIcon(HICON icon, SIZE* size)
6 | {
7 | HBITMAP bmp = 0;
8 | ICONINFO ii;
9 | if(!GetIconInfo(icon, &ii))
10 | return 0;
11 |
12 | BITMAP bm;
13 | if(!GetObject(ii.hbmColor, sizeof(BITMAP), &bm))
14 | goto abruption;
15 | if(bm.bmWidth > 128 || bm.bmHeight > 128)
16 | goto abruption;
17 |
18 | bmp = CreateBitmap(bm.bmWidth, bm.bmHeight, 1, 32, NULL);
19 | if(size)
20 | {
21 | size->cx = bm.bmWidth;
22 | size->cy = bm.bmHeight;
23 | }
24 | HDC dest = CreateCompatibleDC(NULL);
25 | HBITMAP oldBmp = (HBITMAP)SelectObject(dest, bmp);
26 |
27 | // clear bitmap
28 | HBRUSH trans = CreateSolidBrush(0);
29 | { RECT rect = { 0, 0, bm.bmWidth, bm.bmHeight };
30 | FillRect(dest, &rect, trans); }
31 | DeleteObject(trans);
32 |
33 | // draw icon
34 | //DrawIcon(dest, 0, 0, icon);
35 | DrawIconEx(dest, 0, 0, icon, bm.bmWidth, bm.bmHeight, 0, NULL, DI_NORMAL);
36 | SelectObject(dest, oldBmp);
37 | DeleteDC(dest);
38 |
39 | // read bitmap
40 | if(!GetObject(bmp, sizeof(BITMAP), &bm))
41 | goto abruption;
42 | char buffer[128 * 128* 4];
43 | if(!GetBitmapBits(bmp, bm.bmWidthBytes * bm.bmHeight, &buffer))
44 | goto abruption;
45 |
46 | // try to find alpha information
47 | DWORD* pos, * end;
48 | for(int y = bm.bmHeight - 1; y >= 0; --y)
49 | {
50 | pos = (DWORD*)&buffer[y * bm.bmWidthBytes];
51 | end = pos + bm.bmWidth;
52 |
53 | for(; pos < end; ++pos)
54 | if(*pos & 0xff000000)
55 | { // found
56 | DeleteObject(ii.hbmColor);
57 | DeleteObject(ii.hbmMask);
58 | return bmp;
59 | }
60 | }
61 |
62 | // there was no alpha information
63 | // try to apply the icon mask
64 |
65 | BITMAP bmMask;
66 | if(!GetObject(ii.hbmMask, sizeof(BITMAP), &bmMask))
67 | goto abruption;
68 |
69 | unsigned char mask[128 * 128 / 8];
70 | if(bmMask.bmBitsPixel != 1 || bmMask.bmWidthBytes * bmMask.bmHeight > 128 * 128 / 8)
71 | goto abruption;
72 |
73 | if(!GetBitmapBits(ii.hbmMask, bmMask.bmWidthBytes * bmMask.bmHeight, mask))
74 | goto abruption;
75 |
76 | unsigned char* maskPos;
77 | int maskSubPos;
78 | for(int y = bm.bmHeight - 1; y >= 0; --y)
79 | {
80 | pos = (DWORD*)&buffer[y * bm.bmWidthBytes];
81 | end = pos + bm.bmWidth;
82 | maskPos = &mask[y * bmMask.bmWidthBytes];
83 | maskSubPos = 7;
84 | for(; pos < end; ++pos)
85 | {
86 | if(*maskPos & (1 << maskSubPos)) // transparent
87 | {
88 | *pos = 0x0;
89 | }
90 | else // not transparent
91 | {
92 | *pos |= 0xff000000;
93 | }
94 | if(--maskSubPos < 0)
95 | {
96 | maskSubPos = 7;
97 | ++maskPos;
98 | }
99 | }
100 | }
101 |
102 | if(!SetBitmapBits(bmp, bm.bmWidthBytes * bm.bmHeight, buffer))
103 | goto abruption;
104 |
105 | DeleteObject(ii.hbmColor);
106 | DeleteObject(ii.hbmMask);
107 | return bmp;
108 |
109 | abruption:
110 | DeleteObject(ii.hbmColor);
111 | DeleteObject(ii.hbmMask);
112 | if(bmp)
113 | DeleteObject(bmp);
114 | return 0;
115 | }
116 |
117 | #if 0
118 | HBITMAP CreateBitmapFromIcon(HICON icon)
119 | {
120 | ICONINFO ii;
121 | if(!GetIconInfo(icon, &ii))
122 | return 0;
123 |
124 | BITMAP bmMask;
125 | if(!GetObject(ii.hbmMask, sizeof(BITMAP), &bmMask))
126 | goto abruption;
127 |
128 | unsigned char mask[128 * 128 / 8];
129 | if(bmMask.bmBitsPixel != 1 || bmMask.bmWidthBytes * bmMask.bmHeight > 128 * 128 / 8)
130 | goto abruption;
131 |
132 | BITMAP bmColor;
133 | if(!GetObject(ii.hbmColor, sizeof(BITMAP), &bmColor))
134 | goto abruption;
135 |
136 | char color[128 * 128 * 4];
137 | if(bmColor.bmBitsPixel != 32 || bmColor.bmWidthBytes * bmColor.bmHeight > 128 * 128 * 4)
138 | goto abruption;
139 |
140 | if(!GetBitmapBits(ii.hbmMask, bmMask.bmWidthBytes * bmMask.bmHeight, mask) ||
141 | !GetBitmapBits(ii.hbmColor, bmColor.bmWidthBytes * bmColor.bmHeight, color))
142 | goto abruption;
143 |
144 | DWORD* pos, * end;
145 | unsigned char* maskPos;
146 | int maskSubPos;
147 | for(int y = bmColor.bmHeight - 1; y >= 0; --y)
148 | {
149 | pos = (DWORD*)&color[y * bmColor.bmWidthBytes];
150 | end = pos + bmColor.bmWidth;
151 | maskPos = &mask[y * bmMask.bmWidthBytes];
152 | maskSubPos = 7;
153 | for(; pos < end; ++pos)
154 | {
155 | if(*maskPos & (1 << maskSubPos)) // transparent
156 | {
157 | *pos = 0x0;
158 | }
159 | else // not transparent
160 | {
161 | if(*pos & 0xff000000) // alpha channel has the same opinion => ii.hbmColor is ok
162 | {
163 | //DeleteObject(ii.hbmMask);
164 | //return ii.hbmColor;
165 | }
166 | else // apply mask
167 | {
168 | *pos |= 0xff000000;
169 | }
170 | }
171 | if(--maskSubPos < 0)
172 | {
173 | maskSubPos = 7;
174 | ++maskPos;
175 | }
176 | }
177 | }
178 |
179 | if(!SetBitmapBits(ii.hbmColor, bmColor.bmWidthBytes * bmColor.bmHeight, color))
180 | goto abruption;
181 |
182 | DeleteObject(ii.hbmMask);
183 | return ii.hbmColor;
184 |
185 | abruption:
186 | DeleteObject(ii.hbmColor);
187 | DeleteObject(ii.hbmMask);
188 | return 0;
189 | }
190 | #endif
191 |
192 |
--------------------------------------------------------------------------------
/Skins/Default/defaultBg.bmp:
--------------------------------------------------------------------------------
1 | BM6 6 ( ( (
--------------------------------------------------------------------------------
/Src/Dock/main.cpp:
--------------------------------------------------------------------------------
1 | // bdock.cpp : Defines the entry point for the application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #if defined(_DEBUG) && defined(DEBUG_CONSOLE)
7 |
8 | #pragma comment(linker, "/subsystem:console")
9 |
10 | // Console main function, this code is from WinMainCRTStartup()
11 | int _tmain( DWORD, TCHAR**, TCHAR** )
12 | {
13 | // set the event handler
14 | struct Console
15 | {
16 | static BOOL WINAPI CtrlHandler(DWORD dwCtrlType)
17 | {
18 | switch(dwCtrlType)
19 | {
20 | case CTRL_C_EVENT:
21 | case CTRL_BREAK_EVENT:
22 | case CTRL_CLOSE_EVENT:
23 | case CTRL_LOGOFF_EVENT:
24 | case CTRL_SHUTDOWN_EVENT:
25 | ExitProcess(0);
26 | break;
27 | }
28 | return TRUE;
29 | }
30 | };
31 | SetConsoleCtrlHandler(Console::CtrlHandler, TRUE);
32 |
33 | // get command line
34 | LPTSTR lpszCommandLine = ::GetCommandLine();
35 | if(lpszCommandLine == NULL)
36 | return -1;
37 | if(*lpszCommandLine == _T('\"'))
38 | {
39 | do
40 | {
41 | lpszCommandLine = ::CharNext(lpszCommandLine);
42 | } while(*lpszCommandLine != _T('\"') && *lpszCommandLine);
43 | if(*lpszCommandLine == _T('\"'))
44 | lpszCommandLine = ::CharNext(lpszCommandLine);
45 | }
46 | else
47 | {
48 | while(*lpszCommandLine != _T(' ') && *lpszCommandLine)
49 | lpszCommandLine = ::CharNext(lpszCommandLine);
50 | }
51 | while(*lpszCommandLine && *lpszCommandLine <= _T(' '))
52 | lpszCommandLine = ::CharNext(lpszCommandLine);
53 |
54 | // call win32 main function
55 | STARTUPINFO StartupInfo;
56 | StartupInfo.dwFlags = 0;
57 | ::GetStartupInfo(&StartupInfo);
58 | return _tWinMain(::GetModuleHandle(NULL), NULL, lpszCommandLine, (StartupInfo.dwFlags & STARTF_USESHOWWINDOW) ? StartupInfo.wShowWindow : SW_SHOWDEFAULT);
59 | }
60 |
61 | #endif
62 |
63 | int APIENTRY _tWinMain(HINSTANCE hInstance,
64 | HINSTANCE hPrevInstance,
65 | LPTSTR lpCmdLine,
66 | int nCmdShow)
67 | {
68 | UNREFERENCED_PARAMETER(hPrevInstance);
69 | UNREFERENCED_PARAMETER(lpCmdLine);
70 |
71 | // Unless there is a debugger attached, create a copy of the executabe and launch the copy.
72 | // That way debugging is a lot easier since we can recompile and restart the process without having to close it in advanced.
73 | #ifdef _DEBUG
74 | {
75 | HWND hwndDock = FindWindow(_T("BDOCK"), NULL);
76 | if(hwndDock != NULL)
77 | SendMessage(hwndDock, WM_CLOSE, 0, 0);
78 | BOOL isDebuggerPresent = FALSE;
79 | if(!CheckRemoteDebuggerPresent(GetCurrentProcess(), &isDebuggerPresent) || !isDebuggerPresent)
80 | {
81 | TCHAR moduleFilenameBuf[256];
82 | DWORD moduleFilenameLen = GetModuleFileName(NULL, moduleFilenameBuf, sizeof(moduleFilenameBuf));
83 | String moduleFilename(moduleFilenameBuf, moduleFilenameLen);
84 | String filename(moduleFilename);
85 | const tchar_t* lastDelimiter = filename.findLastOf(L"\\/");
86 | if(lastDelimiter)
87 | filename = filename.substr(lastDelimiter + 1 - (const tchar_t*)filename);
88 | if(filename == L"BDock.exe")
89 | {
90 | String copyFilename = moduleFilename + L"-copy";
91 | DWORD firstTry = GetTickCount();
92 | for(;;)
93 | {
94 | if(CopyFile(moduleFilename, copyFilename, FALSE))
95 | break;
96 | Sleep(10); // it may take awhile for the running process to close
97 | if(GetTickCount() - firstTry > 1000)
98 | goto copyTimeout; // somethings is wrong, skip this debug code
99 | }
100 | STARTUPINFO si;
101 | PROCESS_INFORMATION pi;
102 | ZeroMemory(&si, sizeof(si));
103 | si.cb = sizeof(si);
104 | ZeroMemory(&pi, sizeof(pi));
105 | CreateProcess(copyFilename, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
106 | return EXIT_SUCCESS;
107 | copyTimeout: ;
108 | }
109 | }
110 | }
111 | #endif
112 |
113 | HANDLE hMutex = CreateMutex(NULL, TRUE, _T("BDock"));
114 | if(!hMutex)
115 | return -1;
116 | #ifndef _DEBUG
117 | if(GetLastError() == ERROR_ALREADY_EXISTS)
118 | {
119 | CloseHandle(hMutex);
120 | return -1;
121 | }
122 | #endif
123 |
124 | WinAPI::Application application(hInstance, ICC_LINK_CLASS);
125 |
126 | // load storage
127 | Storage storage;
128 | {
129 | WCHAR path[MAX_PATH];
130 | if(WinAPI::Shell::getFolderPath(CSIDL_APPDATA | CSIDL_FLAG_CREATE, path, MAX_PATH))
131 | {
132 | String storageFile(path, String::length(path));
133 | storageFile += L"/BDock";
134 | if(GetFileAttributes(storageFile) == INVALID_FILE_ATTRIBUTES)
135 | CreateDirectory(storageFile, 0);
136 | storageFile += L"/config.bd";
137 | storage.load(storageFile);
138 | }
139 | }
140 | if(storage.getNumSectionCount() == 0)
141 | {
142 | storage.setNumSectionCount(1);
143 |
144 | // launcher dock
145 | storage.enterNumSection(0);
146 | storage.setNumSectionCount(2);
147 | storage.enterNumSection(0);
148 | storage.setStr(_T("name"), _T("launcher"));
149 | storage.leave();
150 | storage.enterNumSection(1);
151 | storage.setStr(_T("name"), _T("hidetaskbar"));
152 | storage.leave();
153 | storage.leave();
154 |
155 | /*
156 | // system tray dock
157 | storage.enterNumSection(1);
158 | storage.setInt("alignment", Settings::right);
159 | storage.setInt("rightMargin", 0);
160 | storage.setNumSectionCount(2);
161 | storage.enterNumSection(0);
162 | storage.setStr("name", L"systemtray", 0);
163 | storage.leave();
164 | storage.enterNumSection(1);
165 | storage.setStr("name", L"clock", 0);
166 | storage.leave();
167 | storage.leave();
168 | */
169 | }
170 |
171 | // create docks
172 | Array docks(storage.getNumSectionCount());
173 | for(int i = 0, count = storage.getNumSectionCount(); i < count; ++i)
174 | {
175 | Dock* dock = new Dock(storage, *storage.getNumSection(i));
176 | if(!dock->create())
177 | delete dock;
178 | else
179 | docks.append(dock);
180 | }
181 |
182 | // Main message loop:
183 | UINT exitCode = application.run();
184 |
185 | // delete docks
186 | for(Array::Iterator i = docks.begin(), end = docks.end(); i != end; ++i)
187 | delete *i;
188 | docks.clear();
189 |
190 | CloseHandle(hMutex);
191 | return (int) exitCode;
192 | }
193 |
--------------------------------------------------------------------------------
/Dock.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dock", "Dock.vcxproj", "{035213F3-19F5-7901-29D5-5B4EE3561543}"
5 | EndProject
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Launcher", "Launcher.vcxproj", "{14F571FD-BFDE-D75C-B6D4-8E6645DA7934}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Clock", "Clock.vcxproj", "{98A892AE-A335-9481-AE30-E7B66C44D7A8}"
9 | EndProject
10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HideTaskbar", "HideTaskbar.vcxproj", "{0D451763-0EB8-6EFF-F3D9-774E5B150204}"
11 | EndProject
12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SystemTray", "SystemTray.vcxproj", "{B80E43E1-32E0-79C6-3453-053B7F5F0115}"
13 | EndProject
14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnstd", "libnstd.vcxproj", "{36EDF082-248F-174A-86A0-B30440EF2640}"
15 | EndProject
16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libWinAPI", "libWinAPI.vcxproj", "{4947EA49-C010-B754-48DF-C732E8DDC53A}"
17 | EndProject
18 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{BB38096A-B391-60DC-20D4-4F3EA6B44507}"
19 | EndProject
20 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{AEB42855-4A0A-CC6C-C503-A2E4DA6AE61A}"
21 | EndProject
22 | Global
23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
24 | Debug|Win32 = Debug|Win32
25 | Release|Win32 = Release|Win32
26 | Debug|x64 = Debug|x64
27 | Release|x64 = Release|x64
28 | EndGlobalSection
29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
30 | {035213F3-19F5-7901-29D5-5B4EE3561543}.Debug|Win32.ActiveCfg = Debug|Win32
31 | {035213F3-19F5-7901-29D5-5B4EE3561543}.Debug|Win32.Build.0 = Debug|Win32
32 | {035213F3-19F5-7901-29D5-5B4EE3561543}.Release|Win32.ActiveCfg = Release|Win32
33 | {035213F3-19F5-7901-29D5-5B4EE3561543}.Release|Win32.Build.0 = Release|Win32
34 | {035213F3-19F5-7901-29D5-5B4EE3561543}.Debug|x64.ActiveCfg = Debug|x64
35 | {035213F3-19F5-7901-29D5-5B4EE3561543}.Debug|x64.Build.0 = Debug|x64
36 | {035213F3-19F5-7901-29D5-5B4EE3561543}.Release|x64.ActiveCfg = Release|x64
37 | {035213F3-19F5-7901-29D5-5B4EE3561543}.Release|x64.Build.0 = Release|x64
38 | {14F571FD-BFDE-D75C-B6D4-8E6645DA7934}.Debug|Win32.ActiveCfg = Debug|Win32
39 | {14F571FD-BFDE-D75C-B6D4-8E6645DA7934}.Debug|Win32.Build.0 = Debug|Win32
40 | {14F571FD-BFDE-D75C-B6D4-8E6645DA7934}.Release|Win32.ActiveCfg = Release|Win32
41 | {14F571FD-BFDE-D75C-B6D4-8E6645DA7934}.Release|Win32.Build.0 = Release|Win32
42 | {14F571FD-BFDE-D75C-B6D4-8E6645DA7934}.Debug|x64.ActiveCfg = Debug|x64
43 | {14F571FD-BFDE-D75C-B6D4-8E6645DA7934}.Debug|x64.Build.0 = Debug|x64
44 | {14F571FD-BFDE-D75C-B6D4-8E6645DA7934}.Release|x64.ActiveCfg = Release|x64
45 | {14F571FD-BFDE-D75C-B6D4-8E6645DA7934}.Release|x64.Build.0 = Release|x64
46 | {98A892AE-A335-9481-AE30-E7B66C44D7A8}.Debug|Win32.ActiveCfg = Debug|Win32
47 | {98A892AE-A335-9481-AE30-E7B66C44D7A8}.Debug|Win32.Build.0 = Debug|Win32
48 | {98A892AE-A335-9481-AE30-E7B66C44D7A8}.Release|Win32.ActiveCfg = Release|Win32
49 | {98A892AE-A335-9481-AE30-E7B66C44D7A8}.Release|Win32.Build.0 = Release|Win32
50 | {98A892AE-A335-9481-AE30-E7B66C44D7A8}.Debug|x64.ActiveCfg = Debug|x64
51 | {98A892AE-A335-9481-AE30-E7B66C44D7A8}.Debug|x64.Build.0 = Debug|x64
52 | {98A892AE-A335-9481-AE30-E7B66C44D7A8}.Release|x64.ActiveCfg = Release|x64
53 | {98A892AE-A335-9481-AE30-E7B66C44D7A8}.Release|x64.Build.0 = Release|x64
54 | {0D451763-0EB8-6EFF-F3D9-774E5B150204}.Debug|Win32.ActiveCfg = Debug|Win32
55 | {0D451763-0EB8-6EFF-F3D9-774E5B150204}.Debug|Win32.Build.0 = Debug|Win32
56 | {0D451763-0EB8-6EFF-F3D9-774E5B150204}.Release|Win32.ActiveCfg = Release|Win32
57 | {0D451763-0EB8-6EFF-F3D9-774E5B150204}.Release|Win32.Build.0 = Release|Win32
58 | {0D451763-0EB8-6EFF-F3D9-774E5B150204}.Debug|x64.ActiveCfg = Debug|x64
59 | {0D451763-0EB8-6EFF-F3D9-774E5B150204}.Debug|x64.Build.0 = Debug|x64
60 | {0D451763-0EB8-6EFF-F3D9-774E5B150204}.Release|x64.ActiveCfg = Release|x64
61 | {0D451763-0EB8-6EFF-F3D9-774E5B150204}.Release|x64.Build.0 = Release|x64
62 | {B80E43E1-32E0-79C6-3453-053B7F5F0115}.Debug|Win32.ActiveCfg = Debug|Win32
63 | {B80E43E1-32E0-79C6-3453-053B7F5F0115}.Debug|Win32.Build.0 = Debug|Win32
64 | {B80E43E1-32E0-79C6-3453-053B7F5F0115}.Release|Win32.ActiveCfg = Release|Win32
65 | {B80E43E1-32E0-79C6-3453-053B7F5F0115}.Release|Win32.Build.0 = Release|Win32
66 | {B80E43E1-32E0-79C6-3453-053B7F5F0115}.Debug|x64.ActiveCfg = Debug|x64
67 | {B80E43E1-32E0-79C6-3453-053B7F5F0115}.Debug|x64.Build.0 = Debug|x64
68 | {B80E43E1-32E0-79C6-3453-053B7F5F0115}.Release|x64.ActiveCfg = Release|x64
69 | {B80E43E1-32E0-79C6-3453-053B7F5F0115}.Release|x64.Build.0 = Release|x64
70 | {36EDF082-248F-174A-86A0-B30440EF2640}.Debug|Win32.ActiveCfg = Debug|Win32
71 | {36EDF082-248F-174A-86A0-B30440EF2640}.Debug|Win32.Build.0 = Debug|Win32
72 | {36EDF082-248F-174A-86A0-B30440EF2640}.Release|Win32.ActiveCfg = Release|Win32
73 | {36EDF082-248F-174A-86A0-B30440EF2640}.Release|Win32.Build.0 = Release|Win32
74 | {36EDF082-248F-174A-86A0-B30440EF2640}.Debug|x64.ActiveCfg = Debug|x64
75 | {36EDF082-248F-174A-86A0-B30440EF2640}.Debug|x64.Build.0 = Debug|x64
76 | {36EDF082-248F-174A-86A0-B30440EF2640}.Release|x64.ActiveCfg = Release|x64
77 | {36EDF082-248F-174A-86A0-B30440EF2640}.Release|x64.Build.0 = Release|x64
78 | {4947EA49-C010-B754-48DF-C732E8DDC53A}.Debug|Win32.ActiveCfg = Debug|Win32
79 | {4947EA49-C010-B754-48DF-C732E8DDC53A}.Debug|Win32.Build.0 = Debug|Win32
80 | {4947EA49-C010-B754-48DF-C732E8DDC53A}.Release|Win32.ActiveCfg = Release|Win32
81 | {4947EA49-C010-B754-48DF-C732E8DDC53A}.Release|Win32.Build.0 = Release|Win32
82 | {4947EA49-C010-B754-48DF-C732E8DDC53A}.Debug|x64.ActiveCfg = Debug|x64
83 | {4947EA49-C010-B754-48DF-C732E8DDC53A}.Debug|x64.Build.0 = Debug|x64
84 | {4947EA49-C010-B754-48DF-C732E8DDC53A}.Release|x64.ActiveCfg = Release|x64
85 | {4947EA49-C010-B754-48DF-C732E8DDC53A}.Release|x64.Build.0 = Release|x64
86 | EndGlobalSection
87 | GlobalSection(SolutionProperties) = preSolution
88 | HideSolutionNode = FALSE
89 | EndGlobalSection
90 | GlobalSection(NestedProjects) = preSolution
91 | {14F571FD-BFDE-D75C-B6D4-8E6645DA7934} = {BB38096A-B391-60DC-20D4-4F3EA6B44507}
92 | {98A892AE-A335-9481-AE30-E7B66C44D7A8} = {BB38096A-B391-60DC-20D4-4F3EA6B44507}
93 | {0D451763-0EB8-6EFF-F3D9-774E5B150204} = {BB38096A-B391-60DC-20D4-4F3EA6B44507}
94 | {B80E43E1-32E0-79C6-3453-053B7F5F0115} = {BB38096A-B391-60DC-20D4-4F3EA6B44507}
95 | {36EDF082-248F-174A-86A0-B30440EF2640} = {AEB42855-4A0A-CC6C-C503-A2E4DA6AE61A}
96 | {4947EA49-C010-B754-48DF-C732E8DDC53A} = {AEB42855-4A0A-CC6C-C503-A2E4DA6AE61A}
97 | EndGlobalSection
98 | EndGlobal
99 |
--------------------------------------------------------------------------------
/Nsis/bdock.nsh:
--------------------------------------------------------------------------------
1 | ; bdock - NSIS Installer Script
2 | ; Copyright (C) 2013 Colin Graf
3 |
4 | ;--------------------------------
5 | ;Includes
6 |
7 | !include "MUI2.nsh"
8 | !include "WinMessages.nsh"
9 | !include "FileFunc.nsh"
10 |
11 | ;--------------------------------
12 | ;Configuration
13 |
14 | ; General
15 | !if "${ARCHITECTURE}" == "64-bit"
16 | Name "BDock ${VERSION} (${ARCHITECTURE})"
17 | !else
18 | Name "BDock ${VERSION}"
19 | !endif
20 | OutFile "BDock_v${VERSION}_Installer_${ARCHITECTURE}.exe"
21 | SetCompressor /SOLID lzma
22 |
23 | ; Request admin rights
24 | RequestExecutionLevel admin
25 |
26 | ; Folder selection page
27 | InstallDir "$PROGRAMFILES\BDock"
28 |
29 | ; Get install folder from registry if available
30 | InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BDock" "InstallDirectory"
31 |
32 | Function .onInit
33 |
34 | ; 64-bit mode?
35 | !if "${ARCHITECTURE}" == "64-bit"
36 | SetRegView 64
37 | ReadRegStr $0 HKLM Software\Microsoft\Windows\CurrentVersion ProgramFilesDir
38 | StrCpy $INSTDIR "$0\BDock"
39 | ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BDock" "InstallDirectory"
40 | StrCmp $0 "" skipInstDirReg
41 | StrCpy $INSTDIR "$0"
42 | skipInstDirReg:
43 | !endif
44 |
45 | ; Offer to start BDock in finish page
46 | !define MUI_FINISHPAGE_RUN_TEXT "Start BDock"
47 | !define MUI_FINISHPAGE_RUN "$INSTDIR\BDock.exe"
48 |
49 | FunctionEnd
50 |
51 | Function un.onInit
52 |
53 | ; 64-bit mode?
54 | !if "${ARCHITECTURE}" == "64-bit"
55 | SetRegView 64
56 | ReadRegStr $0 HKLM Software\Microsoft\Windows\CurrentVersion ProgramFilesDir
57 | StrCpy $INSTDIR "$0\BDock"
58 | ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BDock" "InstallDirectory"
59 | StrCmp $0 "" skipInstDirReg
60 | StrCpy $INSTDIR "$0"
61 | skipInstDirReg:
62 | !endif
63 |
64 | FunctionEnd
65 |
66 |
67 | ;--------------------------------
68 | ;Interface Settings
69 |
70 | !define MUI_ABORTWARNING
71 |
72 | ;--------------------------------
73 | ;Pages
74 |
75 | !insertmacro MUI_PAGE_WELCOME
76 | !insertmacro MUI_PAGE_LICENSE "..\LICENSE"
77 | ; !insertmacro MUI_PAGE_COMPONENTS
78 | !insertmacro MUI_PAGE_DIRECTORY
79 | !insertmacro MUI_PAGE_INSTFILES
80 | !insertmacro MUI_PAGE_FINISH
81 |
82 | ; !insertmacro MUI_UNPAGE_WELCOME
83 | !insertmacro MUI_UNPAGE_CONFIRM
84 | !insertmacro MUI_UNPAGE_INSTFILES
85 | !insertmacro MUI_UNPAGE_FINISH
86 |
87 | ;--------------------------------
88 | ;Languages
89 |
90 | !insertmacro MUI_LANGUAGE "English"
91 |
92 | ;--------------------------------
93 | ;Installer Sections
94 |
95 | Section "!BDock ${VERSION}" MainSection
96 |
97 | SectionIn RO
98 |
99 | ; 64-bit mode?
100 | !if "${ARCHITECTURE}" == "64-bit"
101 | SetRegView 64
102 | !endif
103 |
104 | ; Close running version of bdock
105 | FindWindow $0 "" "BDOCK"
106 | StrCmp $0 0 notRunning
107 | SendMessage $0 ${WM_DESTROY} 0 0
108 | sleep 500
109 | notRunning:
110 |
111 | ; Install program files
112 | SetOutPath "$INSTDIR"
113 | File "..\${BUILDDIR}\BDock.exe"
114 | SetOutPath "$INSTDIR\Plugins\Launcher"
115 | File "..\${BUILDDIR}\Launcher.dll"
116 | SetOutPath "$INSTDIR\Plugins\HideTaskbar"
117 | File "..\${BUILDDIR}\HideTaskbar.dll"
118 |
119 | ; Install classic skin
120 | SetOutPath "$INSTDIR\Skins\Default"
121 | File "..\Skins\Default\*.bmp"
122 |
123 | ; Create uninstaller
124 | WriteUninstaller "$INSTDIR\Uninstall.exe"
125 |
126 | ; Install startup link FOR ALL USERS
127 | StrCpy $0 0
128 | loop:
129 | EnumRegKey $1 HKU "" $0
130 | StrCmp $1 "" done
131 | IntOp $0 $0 + 1
132 | ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Startup"
133 | StrCmp $2 "" loop
134 | CreateShortCut "$2\BDock.lnk" "$INSTDIR\BDock.exe" "" "$INSTDIR\BDock.exe" 0
135 | Goto loop
136 | done:
137 |
138 | ; Store install folder in registry
139 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BDock" "InstallDirectory" "$INSTDIR"
140 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BDock" "InstallVersion" "${VERSION}"
141 |
142 | ; Install uninstaller to registry
143 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BDock" "DisplayName" "${DISPLAYNAME}"
144 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BDock" "DisplayIcon" "$INSTDIR\BDock.exe"
145 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BDock" "DisplayVersion" "${VERSION}"
146 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BDock" "Publisher" "${PUBLISHER}"
147 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BDock" "NoModify" 0x01
148 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BDock" "NoRepair" 0x01
149 |
150 | ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
151 | IntFmt $0 "0x%08X" $0
152 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BDock" "EstimatedSize" $0
153 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BDock" "UninstallString" '"$INSTDIR\uninstall.exe"'
154 |
155 | ; Install start menu entries
156 | SetShellVarContext all
157 | Delete "$SMPROGRAMS\BDock\*.*"
158 | RMDir "$SMPROGRAMS\BDock"
159 | CreateDirectory "$SMPROGRAMS\BDock"
160 | CreateShortCut "$SMPROGRAMS\BDock\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
161 | CreateShortCut "$SMPROGRAMS\BDock\BDock.lnk" "$INSTDIR\BDock.exe" "" "$INSTDIR\BDock.exe" 0
162 |
163 | SectionEnd
164 |
165 | ;--------------------------------
166 | ;Descriptions
167 |
168 | LangString DESC_MainSection ${LANG_ENGLISH} "BDock program files."
169 |
170 | ; !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
171 | ; !insertmacro MUI_DESCRIPTION_TEXT ${MainSection} $(DESC_MainSection)
172 | ; !insertmacro MUI_FUNCTION_DESCRIPTION_END
173 |
174 | ;--------------------------------
175 | ;Uninstaller Section
176 |
177 | Section "Uninstall"
178 |
179 | ; 64-bit mode?
180 | !if "${ARCHITECTURE}" == "64-bit"
181 | SetRegView 64
182 | !endif
183 |
184 | ; Close running version of bdock
185 | FindWindow $0 "" "BDOCK"
186 | StrCmp $0 0 notRunning
187 | SendMessage $0 ${WM_DESTROY} 0 0
188 | sleep 500
189 | notRunning:
190 |
191 | ; Delete program dir
192 | RMDir /R "$INSTDIR"
193 |
194 | ; Remove settings directory in appdata folder and startup link FOR ALL USERS
195 | StrCpy $0 0
196 | loop:
197 | EnumRegKey $1 HKU "" $0
198 | StrCmp $1 "" done
199 | IntOp $0 $0 + 1
200 | ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "AppData"
201 | StrCmp $2 "" loop
202 | RMDir /R "$2\BDock"
203 | ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Startup"
204 | Delete "$2\BDock.lnk"
205 | Goto loop
206 | done:
207 |
208 | ; Remove uninstaller from registry
209 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BDock"
210 |
211 | ; Delete start menu entries
212 | SetShellVarContext all
213 | Delete "$SMPROGRAMS\BDock\*.*"
214 | RMDir "$SMPROGRAMS\BDock"
215 |
216 | SectionEnd
217 |
--------------------------------------------------------------------------------
/Src/Plugins/Launcher/SysTools.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | HMENU CopyMenu(HMENU hmenu)
5 | {
6 | MENUITEMINFO mii;
7 | mii.cbSize = sizeof(mii);
8 | mii.fMask = MIIM_STATE | MIIM_STRING | MIIM_FTYPE | MIIM_ID | MIIM_SUBMENU | MIIM_CHECKMARKS | MIIM_BITMAP;
9 | WCHAR* buf = 0;
10 | int buflen = 0;
11 | HMENU hmenuCopy = CreatePopupMenu();
12 | const int count = GetMenuItemCount(hmenu);
13 | for(int i = 0; i < count; ++i)
14 | {
15 | int len = GetMenuString(hmenu, i, NULL, 0, MF_BYPOSITION) + 1;
16 | if(buflen < len)
17 | {
18 | if(buf)
19 | free(buf);
20 | buf = (WCHAR*)malloc((len + 1) * sizeof(WCHAR));
21 | buflen = len;
22 | }
23 | buf[0] = 0;
24 | mii.dwTypeData = buf;
25 | mii.cch = len;
26 |
27 | GetMenuItemInfo(hmenu, i, TRUE, &mii);
28 | if(mii.hSubMenu)
29 | mii.hSubMenu = CopyMenu(mii.hSubMenu);
30 | InsertMenuItem(hmenuCopy, i, TRUE, &mii);
31 | }
32 | if(buf)
33 | free(buf);
34 | return hmenuCopy;
35 | }
36 |
37 | // TODO: optimize this function using DIB-Bitmap!
38 | HBITMAP CreateBitmapFromIcon(HICON icon, SIZE* size)
39 | {
40 | HBITMAP bmp = 0;
41 | ICONINFO ii;
42 | if(!GetIconInfo(icon, &ii))
43 | return 0;
44 |
45 | BITMAP bm;
46 | if(!GetObject(ii.hbmColor, sizeof(BITMAP), &bm))
47 | goto abruption;
48 | if(bm.bmWidth > 128 || bm.bmHeight > 128)
49 | goto abruption;
50 |
51 | bmp = CreateBitmap(bm.bmWidth, bm.bmHeight, 1, 32, NULL);
52 | if(size)
53 | {
54 | size->cx = bm.bmWidth;
55 | size->cy = bm.bmHeight;
56 | }
57 | HDC dest = CreateCompatibleDC(NULL);
58 | HBITMAP oldBmp = (HBITMAP)SelectObject(dest, bmp);
59 |
60 | // clear bitmap
61 | HBRUSH trans = CreateSolidBrush(0);
62 | { RECT rect = { 0, 0, bm.bmWidth, bm.bmHeight };
63 | FillRect(dest, &rect, trans); }
64 | DeleteObject(trans);
65 |
66 | // draw icon
67 | //DrawIcon(dest, 0, 0, icon);
68 | DrawIconEx(dest, 0, 0, icon, bm.bmWidth, bm.bmHeight, 0, NULL, DI_NORMAL);
69 | SelectObject(dest, oldBmp);
70 | DeleteDC(dest);
71 |
72 | // read bitmap
73 | if(!GetObject(bmp, sizeof(BITMAP), &bm))
74 | goto abruption;
75 | char buffer[128 * 128* 4];
76 | if(!GetBitmapBits(bmp, bm.bmWidthBytes * bm.bmHeight, &buffer))
77 | goto abruption;
78 |
79 | // try to find alpha information
80 | DWORD* pos, * end;
81 | for(int y = bm.bmHeight - 1; y >= 0; --y)
82 | {
83 | pos = (DWORD*)&buffer[y * bm.bmWidthBytes];
84 | end = pos + bm.bmWidth;
85 |
86 | for(; pos < end; ++pos)
87 | if(*pos & 0xff000000)
88 | { // found
89 | DeleteObject(ii.hbmColor);
90 | DeleteObject(ii.hbmMask);
91 | return bmp;
92 | }
93 | }
94 |
95 | // there was no alpha information
96 | // try to apply the icon mask
97 |
98 | BITMAP bmMask;
99 | if(!GetObject(ii.hbmMask, sizeof(BITMAP), &bmMask))
100 | goto abruption;
101 |
102 | unsigned char mask[128 * 128 / 8];
103 | if(bmMask.bmBitsPixel != 1 || bmMask.bmWidthBytes * bmMask.bmHeight > 128 * 128 / 8)
104 | goto abruption;
105 |
106 | if(!GetBitmapBits(ii.hbmMask, bmMask.bmWidthBytes * bmMask.bmHeight, mask))
107 | goto abruption;
108 |
109 | unsigned char* maskPos;
110 | int maskSubPos;
111 | for(int y = bm.bmHeight - 1; y >= 0; --y)
112 | {
113 | pos = (DWORD*)&buffer[y * bm.bmWidthBytes];
114 | end = pos + bm.bmWidth;
115 | maskPos = &mask[y * bmMask.bmWidthBytes];
116 | maskSubPos = 7;
117 | for(; pos < end; ++pos)
118 | {
119 | if(*maskPos & (1 << maskSubPos)) // transparent
120 | {
121 | *pos = 0x0;
122 | }
123 | else // not transparent
124 | {
125 | *pos |= 0xff000000;
126 | }
127 | if(--maskSubPos < 0)
128 | {
129 | maskSubPos = 7;
130 | ++maskPos;
131 | }
132 | }
133 | }
134 |
135 | if(!SetBitmapBits(bmp, bm.bmWidthBytes * bm.bmHeight, buffer))
136 | goto abruption;
137 |
138 | DeleteObject(ii.hbmColor);
139 | DeleteObject(ii.hbmMask);
140 | return bmp;
141 |
142 | abruption:
143 | DeleteObject(ii.hbmColor);
144 | DeleteObject(ii.hbmMask);
145 | if(bmp)
146 | DeleteObject(bmp);
147 | return 0;
148 | }
149 |
150 | HBITMAP CreateResizedBitmap(UINT destWidth, UINT destHeight, HBITMAP hsrc, UINT srcX, UINT srcY, UINT srcWidth, UINT srcHeight)
151 | {
152 | // create source dc
153 | HDC src = CreateCompatibleDC(NULL);
154 | HBITMAP oldSrcBmp = (HBITMAP)SelectObject(src, hsrc);
155 |
156 | // create dest dc
157 | HBITMAP bmp = CreateBitmap(destWidth, destHeight, 1, 32, NULL);
158 | HDC dest = CreateCompatibleDC(NULL);
159 | HBITMAP oldDestBmp = (HBITMAP)SelectObject(dest, bmp);
160 |
161 |
162 | SetStretchBltMode(dest, COLORONCOLOR);
163 | StretchBlt(dest, 0, 0, destWidth, destHeight, src, srcX, srcY, srcWidth, srcHeight, SRCCOPY);
164 |
165 | // cleanup
166 | SelectObject(dest, oldDestBmp);
167 | SelectObject(src, oldSrcBmp);
168 | DeleteDC(dest);
169 | DeleteDC(src);
170 |
171 | return bmp;
172 | }
173 |
174 | HBITMAP CreateBitmapFromIcon(UINT destWidth, UINT destHeight, HICON icon)
175 | {
176 | SIZE size;
177 | HBITMAP hbitmap = CreateBitmapFromIcon(icon, &size);
178 | if(size.cy == destWidth && size.cx == destHeight)
179 | return hbitmap;
180 | HBITMAP hresized = CreateResizedBitmap(destWidth, destHeight, hbitmap, 0, 0, size.cy, size.cx);
181 | DeleteObject(hbitmap);
182 | return hresized;
183 | }
184 |
185 |
186 | #include
187 |
188 | struct NtDll
189 | {
190 | typedef NTSTATUS (NTAPI *pfnNtQueryInformationProcess)(
191 | IN HANDLE ProcessHandle,
192 | IN PROCESSINFOCLASS ProcessInformationClass,
193 | OUT PVOID ProcessInformation,
194 | IN ULONG ProcessInformationLength,
195 | OUT PULONG ReturnLength OPTIONAL
196 | );
197 |
198 | pfnNtQueryInformationProcess NtQueryInformationProcess;
199 |
200 | NtDll() : NtQueryInformationProcess(NULL), hNtDll(NULL) {}
201 |
202 | ~NtDll()
203 | {
204 | if(hNtDll)
205 | FreeLibrary(hNtDll);
206 | }
207 |
208 | bool load()
209 | {
210 | if(!hNtDll)
211 | {
212 | hNtDll = LoadLibrary(_T("ntdll.dll"));
213 | if(hNtDll == NULL)
214 | return false;
215 | }
216 |
217 | if(!NtQueryInformationProcess)
218 | {
219 | NtQueryInformationProcess = (pfnNtQueryInformationProcess)GetProcAddress(hNtDll, "NtQueryInformationProcess");
220 | if(NtQueryInformationProcess == NULL)
221 | return false;
222 | }
223 |
224 | return true;
225 | }
226 |
227 | private:
228 | HMODULE hNtDll;
229 | } ntDll;
230 |
231 |
232 | BOOL GetCommandLine(DWORD pid, LPWSTR commandLine, UINT maxLen)
233 | {
234 | // Earlier versions of BDock used a the Windows Management Instrumentation interface (WMI) to determine the
235 | // command line that was used to launch a process. While this worked most of the time, it was a slow
236 | // and bloated approach.
237 |
238 | // I came across this PEB-based technique after reading an article on getting process info with
239 | // NtQueryInformationProcess by Steven A. Moore
240 | // http://www.codeproject.com/Articles/19685/Get-Process-Info-with-NtQueryInformationProcess
241 |
242 | if(!ntDll.load())
243 | return FALSE;
244 |
245 | LPCWSTR result = 0;
246 |
247 | HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
248 | if(hProcess)
249 | {
250 | PROCESS_BASIC_INFORMATION pbi;
251 | pbi.PebBaseAddress = 0;
252 | if(NT_SUCCESS(ntDll.NtQueryInformationProcess(hProcess, ProcessBasicInformation, &pbi, sizeof(pbi), NULL)))
253 | if(pbi.PebBaseAddress)
254 | {
255 | PEB peb;
256 | SIZE_T bytesRead;
257 | if(ReadProcessMemory(hProcess, pbi.PebBaseAddress, &peb, sizeof(peb), &bytesRead))
258 | if(bytesRead == sizeof(peb))
259 | {
260 | RTL_USER_PROCESS_PARAMETERS upp;
261 | if(ReadProcessMemory(hProcess, peb.ProcessParameters, &upp, sizeof(upp), &bytesRead))
262 | if(bytesRead == sizeof(upp))
263 | {
264 | UINT readLen = upp.CommandLine.Length / sizeof(WCHAR);
265 | if(readLen > maxLen - 1)
266 | readLen = maxLen -1;
267 | if(ReadProcessMemory(hProcess, upp.CommandLine.Buffer, commandLine, readLen * sizeof(WCHAR), &bytesRead))
268 | if(bytesRead == readLen * sizeof(WCHAR))
269 | {
270 | commandLine[readLen] = 0;
271 | CloseHandle(hProcess);
272 | return TRUE;
273 | }
274 | }
275 | }
276 | }
277 |
278 | CloseHandle(hProcess);
279 | }
280 | return FALSE;
281 | }
282 |
--------------------------------------------------------------------------------
/libWinAPI.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | {4947EA49-C010-B754-48DF-C732E8DDC53A}
23 | libWinAPI
24 |
25 |
26 |
27 | StaticLibrary
28 | true
29 | Unicode
30 |
31 |
32 | StaticLibrary
33 | false
34 | Unicode
35 |
36 |
37 | StaticLibrary
38 | true
39 | Unicode
40 |
41 |
42 | StaticLibrary
43 | false
44 | Unicode
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | Build\Debug_Win32\libWinAPI\
64 | Build\Debug_Win32\libWinAPI\
65 | true
66 | Build\Release_Win32\libWinAPI\
67 | Build\Release_Win32\libWinAPI\
68 | Build\Debug_x64\libWinAPI\
69 | Build\Debug_x64\libWinAPI\
70 | true
71 | Build\Release_x64\libWinAPI\
72 | Build\Release_x64\libWinAPI\
73 | WinAPI
74 | .lib
75 | WinAPI
76 | .lib
77 | WinAPI
78 | .lib
79 | WinAPI
80 | .lib
81 |
82 |
83 |
84 | Level3
85 | Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
86 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;%(PreprocessorDefinitions)
87 |
88 |
89 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;%(PreprocessorDefinitions)
90 |
91 |
92 | false
93 |
94 |
95 | true
96 |
97 |
98 |
99 |
100 | Level3
101 | MaxSpeed
102 | true
103 | MultiThreaded
104 | Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
105 | UNICODE;_UNICODE;_WIN32;NDEBUG;%(PreprocessorDefinitions)
106 |
107 |
108 | UNICODE;_UNICODE;_WIN32;NDEBUG;%(PreprocessorDefinitions)
109 |
110 |
111 | false
112 |
113 |
114 | true
115 | true
116 |
117 |
118 |
119 |
120 | Level3
121 | Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
122 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;_WIN64;%(PreprocessorDefinitions)
123 |
124 |
125 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;_WIN64;%(PreprocessorDefinitions)
126 |
127 |
128 | false
129 |
130 |
131 | true
132 |
133 |
134 |
135 |
136 | Level3
137 | MaxSpeed
138 | true
139 | MultiThreaded
140 | Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
141 | UNICODE;_UNICODE;_WIN32;NDEBUG;_WIN64;%(PreprocessorDefinitions)
142 |
143 |
144 | UNICODE;_UNICODE;_WIN32;NDEBUG;_WIN64;%(PreprocessorDefinitions)
145 |
146 |
147 | false
148 |
149 |
150 | true
151 | true
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
--------------------------------------------------------------------------------
/Src/Plugins/SystemTray/SystemTray.cpp:
--------------------------------------------------------------------------------
1 | // SystemTray.cpp : Defines the exported functions for the DLL application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | extern HMODULE hmodule;
7 |
8 | DllInjection::DllInjection() : process(0), injectedModule(0) {}
9 |
10 | DllInjection::~DllInjection()
11 | {
12 | if(process)
13 | {
14 | if(injectedModule)
15 | {
16 | HANDLE hthread;
17 | hthread = CreateRemoteThread(process, NULL, 0, (LPTHREAD_START_ROUTINE)
18 | GetProcAddress(GetModuleHandle(L"kernel32.dll"), "FreeLibrary")/*&FreeLibrary*/, (void*)injectedModule, 0, NULL);
19 | WaitForSingleObject(hthread, INFINITE);
20 | CloseHandle(hthread);
21 | }
22 | CloseHandle(process);
23 | }
24 | }
25 |
26 | bool DllInjection::init(DWORD pid, const wchar_t* dll)
27 | {
28 | process = OpenProcess(PROCESS_CREATE_THREAD | PROCESS_VM_OPERATION | PROCESS_VM_WRITE, FALSE, pid);
29 | if(!process)
30 | return false;
31 |
32 | uint_t injectedStringSize = (uint_t)(wcslen(dll) + 1) * sizeof(wchar_t);
33 | void* injectedString = VirtualAllocEx(process, NULL, injectedStringSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
34 | WriteProcessMemory(process, injectedString, dll, injectedStringSize, NULL);
35 | HANDLE hthread = CreateRemoteThread(process, NULL, NULL, (LPTHREAD_START_ROUTINE)
36 | GetProcAddress(GetModuleHandle(L"kernel32.dll"), "LoadLibraryW")
37 | /*&LoadLibraryW*/, injectedString, NULL, NULL);
38 | if(!hthread)
39 | {
40 | VirtualFreeEx(process, injectedString, injectedStringSize, MEM_RELEASE);
41 | CloseHandle(process);
42 | process = 0;
43 | return false;
44 | }
45 | WaitForSingleObject(hthread, INFINITE);
46 | GetExitCodeThread(hthread, (LPDWORD)&injectedModule);
47 | VirtualFreeEx(process, injectedString, injectedStringSize, MEM_RELEASE);
48 | CloseHandle(hthread);
49 | if(!injectedModule)
50 | {
51 | CloseHandle(process);
52 | process = 0;
53 | return false;
54 | }
55 | return true;
56 | }
57 |
58 | #define WM_SETNIDHOOKWND (WM_USER+503)
59 | HWND nidHookWnd = 0;
60 | WNDPROC TrayWndProc = 0;
61 | LRESULT CALLBACK TrayWndProcHook(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
62 | {
63 | switch(uMsg)
64 | {
65 | case WM_SETNIDHOOKWND:
66 | nidHookWnd = (HWND)lParam;
67 | if(nidHookWnd)
68 | PostMessage(HWND_BROADCAST, RegisterWindowMessage(L"TaskbarCreated"), 0, 0);
69 | else
70 | SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)TrayWndProc);
71 | return (LRESULT)hmodule;
72 | break;
73 | case WM_COPYDATA:
74 | {
75 | PCOPYDATASTRUCT cds = (PCOPYDATASTRUCT)lParam;
76 | if(cds && cds->dwData == 1 && nidHookWnd)
77 | SendMessage(nidHookWnd, uMsg, wParam, lParam);
78 | }
79 | break;
80 | }
81 | return TrayWndProc(hwnd, uMsg, wParam, lParam);
82 | }
83 |
84 |
85 | ATOM SystemTray::wndClass = 0;
86 | int SystemTray::instances = 0;
87 |
88 | SystemTray::SystemTray(Dock& dock) : dock(dock)
89 | {
90 | ++instances;
91 | }
92 |
93 | SystemTray::~SystemTray()
94 | {
95 | if(hwnd)
96 | {
97 | SendMessage(FindWindow(L"Shell_TrayWnd", 0), WM_SETNIDHOOKWND, 0, 0);
98 | DestroyWindow(hwnd);
99 | }
100 |
101 | for(auto i = icons.begin(), end = icons.end(); i != end; ++i)
102 | delete (IconData*)(*i)->userData;
103 |
104 | --instances;
105 | if(instances == 0)
106 | {
107 | if(wndClass)
108 | {
109 | UnregisterClass(L"BDOCKLauncher", hmodule);
110 | wndClass = 0;
111 | }
112 | }
113 | }
114 |
115 | bool SystemTray::init()
116 | {
117 | HWND hshell = FindWindow(L"Shell_TrayWnd", 0);
118 | if(!hshell)
119 | return false;
120 |
121 | DWORD pid;
122 | if(!GetWindowThreadProcessId(hshell, &pid))
123 | return false;
124 |
125 | WCHAR thisDll[MAX_PATH];
126 | GetModuleFileName(GetModuleHandle(L"systemtray.dll"), thisDll, MAX_PATH);
127 | if(!dllInjection.init(pid, thisDll))
128 | return false;
129 |
130 | // register window class
131 | if(!wndClass)
132 | {
133 | WNDCLASSEX wcex;
134 | wcex.cbSize = sizeof(WNDCLASSEX);
135 | wcex.style = 0;
136 | wcex.lpfnWndProc = wndProc;
137 | wcex.cbClsExtra = 0;
138 | wcex.cbWndExtra = 0;
139 | wcex.hInstance = hmodule;
140 | wcex.hIcon = 0;
141 | wcex.hCursor = 0;
142 | wcex.hbrBackground = 0; //(HBRUSH)(COLOR_WINDOW+1);
143 | wcex.lpszMenuName = 0; //MAKEINTRESOURCE(IDC_BDOCK);
144 | wcex.lpszClassName = L"BDOCKSystemTray";
145 | wcex.hIconSm = 0;
146 | wndClass = RegisterClassEx(&wcex);
147 | if(!wndClass)
148 | return false;
149 | }
150 |
151 | hwnd = CreateWindowEx(NULL, L"BDOCKSystemTray", NULL, NULL, NULL, NULL, NULL, NULL, HWND_MESSAGE, NULL, hmodule, this);
152 | if(!hwnd)
153 | return false;
154 |
155 | dllInjection.injectedModule = (HMODULE)SendMessage(FindWindow(L"Shell_TrayWnd", 0), WM_SETNIDHOOKWND, 0, (LPARAM)hwnd);
156 |
157 | return true;
158 | }
159 |
160 | void_t keyOfIcon(const PNOTIFYICONDATA32 nid, wchar_t (&key)[sizeof(GUID) + 1])
161 | {
162 | wchar_t* keypos = key;
163 | if(nid->uFlags & NIF_GUID)
164 | {
165 | wchar_t* src = (wchar_t*)&nid->guidItem;
166 | wchar_t* srcEnd = src + sizeof(GUID);
167 | for(; src < srcEnd; ++src)
168 | *(keypos++) = *src ? *src : 1;
169 | }
170 | else
171 | {
172 | wchar_t* src = (wchar_t*)&nid->hWnd;
173 | wchar_t* srcEnd = src + sizeof(HWND);
174 | for(; src < srcEnd; ++src)
175 | *(keypos++) = *src ? *src : 1;
176 | src = (wchar_t*)&nid->uID;
177 | srcEnd = src + sizeof(UINT);
178 | for(; src < srcEnd; ++src)
179 | *(keypos++) = *src ? *src : 1;
180 | }
181 | *keypos = 0;
182 | }
183 |
184 | void SystemTray::addIcon(PNOTIFYICONDATA32 nid)
185 | {
186 | wchar_t keyBuffer[sizeof(GUID) + 1];
187 | keyOfIcon(nid, keyBuffer);
188 | String key(keyBuffer);
189 | if(icons.find(key) != icons.end())
190 | {
191 | updateIcon2(nid);
192 | return;
193 | }
194 |
195 | if(nid->uFlags & NIF_STATE && (nid->dwState & nid->dwStateMask) & NIS_HIDDEN)
196 | return;
197 |
198 | HBITMAP bmp = createBitmapFromIcon((HICON)nid->hIcon, 0);
199 | Icon* icon = dock.createIcon(bmp, IF_SMALL);
200 | if(!icon)
201 | {
202 | DeleteObject(bmp);
203 | return;
204 | }
205 | IconData* iconData;
206 | icon->userData = iconData = new IconData(*this, (HICON)nid->hIcon, icon, nid);
207 | icon->handleMouseEvent = handleMouseEvent;
208 | // if(nid->uFlags & NIF_GUID)
209 | // memcpy(&iconData->guidItem, &nid->guidItem, sizeof(GUID));
210 | icons.append(key, icon);
211 | }
212 |
213 | void SystemTray::updateIcon2(PNOTIFYICONDATA32 nid)
214 | {
215 | wchar_t keyBuffer[sizeof(GUID) + 1];
216 | keyOfIcon(nid, keyBuffer);
217 | String key(keyBuffer);
218 | auto i = icons.find(key);
219 | if(i == icons.end())
220 | {
221 | //addIcon(nid);
222 | return;
223 | }
224 |
225 | Icon* icon = *i;
226 | IconData* iconData = (IconData*)icon->userData;
227 |
228 | if(nid->uFlags & NIF_ICON && (HICON)nid->hIcon != iconData->hicon)
229 | {
230 | iconData->hicon = (HICON)nid->hIcon;
231 | if(icon->icon)
232 | DeleteObject(icon->icon);
233 | icon->icon = createBitmapFromIcon((HICON)nid->hIcon, 0);
234 | dock.updateIcon(iconData->icon);
235 | }
236 | if(nid->hWnd)
237 | iconData->hwnd = (HWND)nid->hWnd;
238 | if(nid->uFlags & NIF_MESSAGE)
239 | iconData->callbackMessage = nid->uCallbackMessage;
240 | }
241 |
242 | void SystemTray::setIconVersion(PNOTIFYICONDATA32 nid)
243 | {
244 | wchar_t keyBuffer[sizeof(GUID) + 1];
245 | keyOfIcon(nid, keyBuffer);
246 | String key(keyBuffer);
247 |
248 | auto i = icons.find(key);
249 | if(i == icons.end())
250 | return;
251 |
252 | Icon* icon = *i;
253 | IconData* iconData = (IconData*)icon->userData;
254 | iconData->version = nid->uVersion;
255 | }
256 |
257 | void SystemTray::removeIcon(PNOTIFYICONDATA32 nid)
258 | {
259 | wchar_t keyBuffer[sizeof(GUID) + 1];
260 | keyOfIcon(nid, keyBuffer);
261 | String key(keyBuffer);
262 |
263 | auto i = icons.find(key);
264 | if(i == icons.end())
265 | return;
266 |
267 | Icon* icon = *i;
268 | delete (IconData*)icon->userData;
269 | icons.remove(i);
270 | }
271 |
272 | LRESULT CALLBACK SystemTray::wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
273 | {
274 | switch (message)
275 | {
276 | case WM_CREATE:
277 | {
278 | LPCREATESTRUCT cs = (LPCREATESTRUCT)lParam;
279 | SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)cs->lpCreateParams);
280 | }
281 | break;
282 | case WM_COPYDATA:
283 | {
284 | PCOPYDATASTRUCT cds = (PCOPYDATASTRUCT)lParam;
285 | if(cds->dwData == 1)
286 | {
287 | uint_t cmd = *((uint_t*)((char*)cds->lpData + 4));
288 | PNOTIFYICONDATA32 nid = (PNOTIFYICONDATA32)((char*)cds->lpData + 8);
289 | switch(cmd)
290 | {
291 | case NIM_ADD:
292 | ((SystemTray*)GetWindowLongPtr(hwnd, GWLP_USERDATA))->addIcon(nid);
293 | break;
294 | case NIM_MODIFY:
295 | ((SystemTray*)GetWindowLongPtr(hwnd, GWLP_USERDATA))->updateIcon2(nid);
296 | break;
297 | case NIM_DELETE:
298 | ((SystemTray*)GetWindowLongPtr(hwnd, GWLP_USERDATA))->removeIcon(nid);
299 | break;
300 | case NIM_SETFOCUS:
301 | break;
302 | case NIM_SETVERSION:
303 | ((SystemTray*)GetWindowLongPtr(hwnd, GWLP_USERDATA))->setIconVersion(nid);
304 | break;
305 | }
306 | }
307 | }
308 | break;
309 | default:
310 | return DefWindowProc(hwnd, message, wParam, lParam);
311 | }
312 | return 0;
313 | }
314 |
315 | int SystemTray::handleMouseEvent(Icon* icon, unsigned int message, int x, int y)
316 | {
317 | switch(message)
318 | {
319 | case WM_LBUTTONDOWN:
320 | case WM_LBUTTONUP:
321 | case WM_LBUTTONDBLCLK:
322 | case WM_MBUTTONDOWN:
323 | case WM_MBUTTONUP:
324 | case WM_MBUTTONDBLCLK:
325 | case WM_RBUTTONDOWN:
326 | case WM_RBUTTONUP:
327 | case WM_RBUTTONDBLCLK:
328 | case WM_MOUSEMOVE:
329 | {
330 | IconData* iconData = (IconData*)icon->userData;
331 | if(iconData->callbackMessage)
332 | {
333 | if(message == WM_LBUTTONUP || message == WM_MBUTTONUP || message == WM_RBUTTONUP)
334 | SetForegroundWindow(iconData->hwnd);
335 |
336 | if(iconData->version == NOTIFYICON_VERSION_4)
337 | SendMessage(iconData->hwnd, iconData->callbackMessage, MAKELONG(x, y), MAKELONG(message, iconData->id));
338 | else
339 | SendMessage(iconData->hwnd, iconData->callbackMessage, iconData->id, message);
340 |
341 |
342 | }
343 | }
344 | break;
345 | //case WM_CONTEXTMENU:
346 | //break;
347 | default:
348 | return -1;
349 | }
350 | return 0;
351 | }
352 |
353 | IconData::IconData(SystemTray& systemTray, HICON hicon, Icon* icon, PNOTIFYICONDATA32 nid) :
354 | systemTray(systemTray), hicon(hicon), icon(icon), hwnd((HWND)nid->hWnd),
355 | callbackMessage(nid->uFlags & NIF_MESSAGE ? nid->uCallbackMessage : 0),
356 | version(0), id(nid->uID)
357 | {
358 | }
359 |
360 | IconData::~IconData()
361 | {
362 | if(icon)
363 | {
364 | if(icon->icon)
365 | DeleteObject(icon->icon);
366 | systemTray.dock.destroyIcon(icon);
367 | }
368 | }
369 |
--------------------------------------------------------------------------------
/libnstd.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | {36EDF082-248F-174A-86A0-B30440EF2640}
23 | libnstd
24 |
25 |
26 |
27 | StaticLibrary
28 | true
29 | Unicode
30 |
31 |
32 | StaticLibrary
33 | false
34 | Unicode
35 |
36 |
37 | StaticLibrary
38 | true
39 | Unicode
40 |
41 |
42 | StaticLibrary
43 | false
44 | Unicode
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | Build\Debug_Win32\libnstd\
64 | Build\Debug_Win32\libnstd\
65 | true
66 | Build\Release_Win32\libnstd\
67 | Build\Release_Win32\libnstd\
68 | Build\Debug_x64\libnstd\
69 | Build\Debug_x64\libnstd\
70 | true
71 | Build\Release_x64\libnstd\
72 | Build\Release_x64\libnstd\
73 | nstd
74 | .lib
75 | nstd
76 | .lib
77 | nstd
78 | .lib
79 | nstd
80 | .lib
81 |
82 |
83 |
84 | Level3
85 | Ext/libnstd/include;%(AdditionalIncludeDirectories)
86 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
87 |
88 |
89 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
90 |
91 |
92 | false
93 |
94 |
95 | true
96 |
97 |
98 |
99 |
100 | Level3
101 | MaxSpeed
102 | true
103 | MultiThreaded
104 | Ext/libnstd/include;%(AdditionalIncludeDirectories)
105 | UNICODE;_UNICODE;_WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
106 |
107 |
108 | UNICODE;_UNICODE;_WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
109 |
110 |
111 | false
112 |
113 |
114 | true
115 | true
116 |
117 |
118 |
119 |
120 | Level3
121 | Ext/libnstd/include;%(AdditionalIncludeDirectories)
122 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;_WIN64;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
123 |
124 |
125 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;_WIN64;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
126 |
127 |
128 | false
129 |
130 |
131 | true
132 |
133 |
134 |
135 |
136 | Level3
137 | MaxSpeed
138 | true
139 | MultiThreaded
140 | Ext/libnstd/include;%(AdditionalIncludeDirectories)
141 | UNICODE;_UNICODE;_WIN32;NDEBUG;_WIN64;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
142 |
143 |
144 | UNICODE;_UNICODE;_WIN32;NDEBUG;_WIN64;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
145 |
146 |
147 | false
148 |
149 |
150 | true
151 | true
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/Clock.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | {98A892AE-A335-9481-AE30-E7B66C44D7A8}
23 | Clock
24 |
25 |
26 |
27 | DynamicLibrary
28 | true
29 | Unicode
30 |
31 |
32 | DynamicLibrary
33 | false
34 | Unicode
35 |
36 |
37 | DynamicLibrary
38 | true
39 | Unicode
40 |
41 |
42 | DynamicLibrary
43 | false
44 | Unicode
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | Build\Debug_Win32\
64 | Build\Debug_Win32\Clock\
65 | true
66 | Build\Release_Win32\
67 | Build\Release_Win32\Clock\
68 | Build\Debug_x64\
69 | Build\Debug_x64\Clock\
70 | true
71 | Build\Release_x64\
72 | Build\Release_x64\Clock\
73 | Clock
74 | .dll
75 | Clock
76 | .dll
77 | Clock
78 | .dll
79 | Clock
80 | .dll
81 |
82 |
83 |
84 | Level3
85 | Use
86 | Ext/libnstd/include;Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
87 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;%(PreprocessorDefinitions)
88 |
89 |
90 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;%(PreprocessorDefinitions)
91 |
92 |
93 | false
94 |
95 |
96 | true
97 | nstd.lib;WinAPI.lib;%(AdditionalDependencies)
98 | Build/Debug_Win32/libnstd;Build/Debug_Win32/libWinAPI;%(AdditionalLibraryDirectories)
99 |
100 |
101 |
102 |
103 | Level3
104 | MaxSpeed
105 | true
106 | MultiThreaded
107 | Use
108 | Ext/libnstd/include;Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
109 | UNICODE;_UNICODE;_WIN32;NDEBUG;%(PreprocessorDefinitions)
110 |
111 |
112 | UNICODE;_UNICODE;_WIN32;NDEBUG;%(PreprocessorDefinitions)
113 |
114 |
115 | false
116 |
117 |
118 | true
119 | true
120 | nstd.lib;WinAPI.lib;%(AdditionalDependencies)
121 | Build/Release_Win32/libnstd;Build/Release_Win32/libWinAPI;%(AdditionalLibraryDirectories)
122 |
123 |
124 |
125 |
126 | Level3
127 | Use
128 | Ext/libnstd/include;Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
129 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;_WIN64;%(PreprocessorDefinitions)
130 |
131 |
132 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;_WIN64;%(PreprocessorDefinitions)
133 |
134 |
135 | false
136 |
137 |
138 | true
139 | nstd.lib;WinAPI.lib;%(AdditionalDependencies)
140 | Build/Debug_x64/libnstd;Build/Debug_x64/libWinAPI;%(AdditionalLibraryDirectories)
141 |
142 |
143 |
144 |
145 | Level3
146 | MaxSpeed
147 | true
148 | MultiThreaded
149 | Use
150 | Ext/libnstd/include;Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
151 | UNICODE;_UNICODE;_WIN32;NDEBUG;_WIN64;%(PreprocessorDefinitions)
152 |
153 |
154 | UNICODE;_UNICODE;_WIN32;NDEBUG;_WIN64;%(PreprocessorDefinitions)
155 |
156 |
157 | false
158 |
159 |
160 | true
161 | true
162 | nstd.lib;WinAPI.lib;%(AdditionalDependencies)
163 | Build/Release_x64/libnstd;Build/Release_x64/libWinAPI;%(AdditionalLibraryDirectories)
164 |
165 |
166 |
167 |
168 |
169 |
170 | Create
171 | Create
172 | Create
173 | Create
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 | {36EDF082-248F-174A-86A0-B30440EF2640}
185 |
186 |
187 | {4947EA49-C010-B754-48DF-C732E8DDC53A}
188 |
189 |
190 |
191 |
192 |
193 |
194 |
--------------------------------------------------------------------------------
/HideTaskbar.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | {0D451763-0EB8-6EFF-F3D9-774E5B150204}
23 | HideTaskbar
24 |
25 |
26 |
27 | DynamicLibrary
28 | true
29 | Unicode
30 |
31 |
32 | DynamicLibrary
33 | false
34 | Unicode
35 |
36 |
37 | DynamicLibrary
38 | true
39 | Unicode
40 |
41 |
42 | DynamicLibrary
43 | false
44 | Unicode
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | Build\Debug_Win32\
64 | Build\Debug_Win32\HideTaskbar\
65 | true
66 | Build\Release_Win32\
67 | Build\Release_Win32\HideTaskbar\
68 | Build\Debug_x64\
69 | Build\Debug_x64\HideTaskbar\
70 | true
71 | Build\Release_x64\
72 | Build\Release_x64\HideTaskbar\
73 | HideTaskbar
74 | .dll
75 | HideTaskbar
76 | .dll
77 | HideTaskbar
78 | .dll
79 | HideTaskbar
80 | .dll
81 |
82 |
83 |
84 | Level3
85 | Use
86 | Ext/libnstd/include;Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
87 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;%(PreprocessorDefinitions)
88 |
89 |
90 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;%(PreprocessorDefinitions)
91 |
92 |
93 | false
94 |
95 |
96 | true
97 | nstd.lib;WinAPI.lib;%(AdditionalDependencies)
98 | Build/Debug_Win32/libnstd;Build/Debug_Win32/libWinAPI;%(AdditionalLibraryDirectories)
99 |
100 |
101 |
102 |
103 | Level3
104 | MaxSpeed
105 | true
106 | MultiThreaded
107 | Use
108 | Ext/libnstd/include;Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
109 | UNICODE;_UNICODE;_WIN32;NDEBUG;%(PreprocessorDefinitions)
110 |
111 |
112 | UNICODE;_UNICODE;_WIN32;NDEBUG;%(PreprocessorDefinitions)
113 |
114 |
115 | false
116 |
117 |
118 | true
119 | true
120 | nstd.lib;WinAPI.lib;%(AdditionalDependencies)
121 | Build/Release_Win32/libnstd;Build/Release_Win32/libWinAPI;%(AdditionalLibraryDirectories)
122 |
123 |
124 |
125 |
126 | Level3
127 | Use
128 | Ext/libnstd/include;Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
129 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;_WIN64;%(PreprocessorDefinitions)
130 |
131 |
132 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;_WIN64;%(PreprocessorDefinitions)
133 |
134 |
135 | false
136 |
137 |
138 | true
139 | nstd.lib;WinAPI.lib;%(AdditionalDependencies)
140 | Build/Debug_x64/libnstd;Build/Debug_x64/libWinAPI;%(AdditionalLibraryDirectories)
141 |
142 |
143 |
144 |
145 | Level3
146 | MaxSpeed
147 | true
148 | MultiThreaded
149 | Use
150 | Ext/libnstd/include;Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
151 | UNICODE;_UNICODE;_WIN32;NDEBUG;_WIN64;%(PreprocessorDefinitions)
152 |
153 |
154 | UNICODE;_UNICODE;_WIN32;NDEBUG;_WIN64;%(PreprocessorDefinitions)
155 |
156 |
157 | false
158 |
159 |
160 | true
161 | true
162 | nstd.lib;WinAPI.lib;%(AdditionalDependencies)
163 | Build/Release_x64/libnstd;Build/Release_x64/libWinAPI;%(AdditionalLibraryDirectories)
164 |
165 |
166 |
167 |
168 |
169 |
170 | Create
171 | Create
172 | Create
173 | Create
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 | {36EDF082-248F-174A-86A0-B30440EF2640}
185 |
186 |
187 | {4947EA49-C010-B754-48DF-C732E8DDC53A}
188 |
189 |
190 |
191 |
192 |
193 |
194 |
--------------------------------------------------------------------------------
/Launcher.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | {14F571FD-BFDE-D75C-B6D4-8E6645DA7934}
23 | Launcher
24 |
25 |
26 |
27 | DynamicLibrary
28 | true
29 | Unicode
30 |
31 |
32 | DynamicLibrary
33 | false
34 | Unicode
35 |
36 |
37 | DynamicLibrary
38 | true
39 | Unicode
40 |
41 |
42 | DynamicLibrary
43 | false
44 | Unicode
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | Build\Debug_Win32\
64 | Build\Debug_Win32\Launcher\
65 | true
66 | Build\Release_Win32\
67 | Build\Release_Win32\Launcher\
68 | Build\Debug_x64\
69 | Build\Debug_x64\Launcher\
70 | true
71 | Build\Release_x64\
72 | Build\Release_x64\Launcher\
73 | Launcher
74 | .dll
75 | Launcher
76 | .dll
77 | Launcher
78 | .dll
79 | Launcher
80 | .dll
81 |
82 |
83 |
84 | Level3
85 | Use
86 | Ext/libnstd/include;Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
87 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;%(PreprocessorDefinitions)
88 |
89 |
90 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;%(PreprocessorDefinitions)
91 |
92 |
93 | false
94 |
95 |
96 | true
97 | nstd.lib;WinAPI.lib;%(AdditionalDependencies)
98 | Build/Debug_Win32/libnstd;Build/Debug_Win32/libWinAPI;%(AdditionalLibraryDirectories)
99 |
100 |
101 |
102 |
103 | Level3
104 | MaxSpeed
105 | true
106 | MultiThreaded
107 | Use
108 | Ext/libnstd/include;Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
109 | UNICODE;_UNICODE;_WIN32;NDEBUG;%(PreprocessorDefinitions)
110 |
111 |
112 | UNICODE;_UNICODE;_WIN32;NDEBUG;%(PreprocessorDefinitions)
113 |
114 |
115 | false
116 |
117 |
118 | true
119 | true
120 | nstd.lib;WinAPI.lib;%(AdditionalDependencies)
121 | Build/Release_Win32/libnstd;Build/Release_Win32/libWinAPI;%(AdditionalLibraryDirectories)
122 |
123 |
124 |
125 |
126 | Level3
127 | Use
128 | Ext/libnstd/include;Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
129 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;_WIN64;%(PreprocessorDefinitions)
130 |
131 |
132 | UNICODE;_UNICODE;_WIN32;DEBUG;_DEBUG;_WIN64;%(PreprocessorDefinitions)
133 |
134 |
135 | false
136 |
137 |
138 | true
139 | nstd.lib;WinAPI.lib;%(AdditionalDependencies)
140 | Build/Debug_x64/libnstd;Build/Debug_x64/libWinAPI;%(AdditionalLibraryDirectories)
141 |
142 |
143 |
144 |
145 | Level3
146 | MaxSpeed
147 | true
148 | MultiThreaded
149 | Use
150 | Ext/libnstd/include;Ext/libWinAPI/include;%(AdditionalIncludeDirectories)
151 | UNICODE;_UNICODE;_WIN32;NDEBUG;_WIN64;%(PreprocessorDefinitions)
152 |
153 |
154 | UNICODE;_UNICODE;_WIN32;NDEBUG;_WIN64;%(PreprocessorDefinitions)
155 |
156 |
157 | false
158 |
159 |
160 | true
161 | true
162 | nstd.lib;WinAPI.lib;%(AdditionalDependencies)
163 | Build/Release_x64/libnstd;Build/Release_x64/libWinAPI;%(AdditionalLibraryDirectories)
164 |
165 |
166 |
167 |
168 |
169 |
170 | Create
171 | Create
172 | Create
173 | Create
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 | {36EDF082-248F-174A-86A0-B30440EF2640}
187 |
188 |
189 | {4947EA49-C010-B754-48DF-C732E8DDC53A}
190 |
191 |
192 |
193 |
194 |
195 |
196 |
--------------------------------------------------------------------------------