├── .gitignore
├── LICENSE.txt
├── README.md
├── akb.sln
├── akb
├── akb.c
├── akb.rc
├── akb.vcxproj
├── resource.h
└── winapi.h
├── akbcf
├── AssemblyInfo.cpp
├── EditForm.cpp
├── EditForm.h
├── EditForm.resX
├── acl.h
├── akbcf.cpp
├── akbcf.vcxproj
└── akbcf.vcxproj.filters
├── common
├── akb.h
├── hybrid.h
└── wincli.h
├── doc
└── akb.txt
└── release.bat
/.gitignore:
--------------------------------------------------------------------------------
1 | # Output directories
2 | bin/
3 | obj/
4 |
5 | # Visual Studio files
6 | .vs/
7 | *.aps
8 | *.db
9 | *.ncb
10 | *.opendb
11 | *.sdf
12 | *.suo
13 | *.user
14 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012, MALU
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 | 2. Redistributions in binary form must reproduce the above copyright notice,
10 | this list of conditions and the following disclaimer in the documentation
11 | and/or other materials provided with the distribution.
12 |
13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Apple Keyboard Bridge
2 | =====================
3 |
4 | version 0.1.3
5 |
6 |
7 | Change Log
8 | ----------
9 |
10 | * 0.1.3
11 | * Added support for Apple Magic Keyboard JIS/US 2015
12 | * Added monitor brightness command
13 | * 0.1.2
14 | * Added "Zenkaku/Hankaku" for key mapping
15 | * 0.1.1
16 | * Added support for Apple Wireless Keyboard JIS/US 2011
17 |
18 |
19 | Purpose
20 | -------
21 |
22 | The Apple Keyboard Bridge is a tool that enables using of
23 | Apple Wireless Keyboard with Windows bluetooth connection.
24 |
25 | * Fn+ combination keys
26 | * Eject, 英数 and かな keys
27 |
28 | Requirements
29 | ------------
30 |
31 | * Windows XP or greater
32 | * Windows standard bluetooth stack
33 |
34 |
35 | License
36 | -------
37 |
38 | 2-clause BSD license
39 |
--------------------------------------------------------------------------------
/akb.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.28729.10
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "common", "common", "{E5922078-C975-418F-ACC4-1D79B4678631}"
7 | ProjectSection(SolutionItems) = preProject
8 | common\akb.h = common\akb.h
9 | common\hybrid.h = common\hybrid.h
10 | common\wincli.h = common\wincli.h
11 | EndProjectSection
12 | EndProject
13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "akb", "akb\akb.vcxproj", "{8002A1D9-681D-4D65-B04D-8BBF9E4435E9}"
14 | EndProject
15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "akbcf", "akbcf\akbcf.vcxproj", "{1D163A1A-D710-4964-A1F8-8D332DF5B02C}"
16 | EndProject
17 | Global
18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
19 | Debug|Win32 = Debug|Win32
20 | Release|Win32 = Release|Win32
21 | EndGlobalSection
22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
23 | {8002A1D9-681D-4D65-B04D-8BBF9E4435E9}.Debug|Win32.ActiveCfg = Debug|Win32
24 | {8002A1D9-681D-4D65-B04D-8BBF9E4435E9}.Debug|Win32.Build.0 = Debug|Win32
25 | {8002A1D9-681D-4D65-B04D-8BBF9E4435E9}.Release|Win32.ActiveCfg = Release|Win32
26 | {8002A1D9-681D-4D65-B04D-8BBF9E4435E9}.Release|Win32.Build.0 = Release|Win32
27 | {1D163A1A-D710-4964-A1F8-8D332DF5B02C}.Debug|Win32.ActiveCfg = Debug|Win32
28 | {1D163A1A-D710-4964-A1F8-8D332DF5B02C}.Debug|Win32.Build.0 = Debug|Win32
29 | {1D163A1A-D710-4964-A1F8-8D332DF5B02C}.Release|Win32.ActiveCfg = Release|Win32
30 | {1D163A1A-D710-4964-A1F8-8D332DF5B02C}.Release|Win32.Build.0 = Release|Win32
31 | EndGlobalSection
32 | GlobalSection(SolutionProperties) = preSolution
33 | HideSolutionNode = FALSE
34 | EndGlobalSection
35 | EndGlobal
36 |
--------------------------------------------------------------------------------
/akb/akb.c:
--------------------------------------------------------------------------------
1 | /**
2 | * Apple Keyboard Bridge https://github.com/andantissimo/Apple-Keyboard-Bridge
3 | */
4 | #include "../common/akb.h"
5 | #include "winapi.h"
6 |
7 | #include "resource.h"
8 |
9 | BYTE addsb(BYTE x, int a)
10 | {
11 | /* Add with Saturation in BYTE */
12 | int r = (int)x + a;
13 | if (r < 0x00) r = 0x00;
14 | if (r > 0xFF) r = 0xFF;
15 | return (BYTE)r;
16 | }
17 |
18 | const CLSID CLSID_WbemLocator = { 0x4590F811, 0x1D3A, 0x11D0, { 0x89, 0x1F, 0x00, 0xAA, 0x00, 0x4B, 0x2E, 0x24 } };
19 | const IID IID_IWbemLocator = { 0xDC12A687, 0x737F, 0x11CF, { 0x88, 0x4D, 0x00, 0xAA, 0x00, 0x4B, 0x2E, 0x24 } };
20 |
21 | enum
22 | {
23 | VID_APPLE = 0x05AC,
24 | };
25 | const static WORD PID_APPLE_KEYBOARD[] =
26 | {
27 | 0x022C, /* Apple Wireless Keyboard US 2007 */
28 | 0x022E, /* Apple Wireless Keyboard JIS 2007 */
29 | 0x0239, /* Apple Wireless Keyboard US 2009 */
30 | 0x023B, /* Apple Wireless Keyboard JIS 2009 */
31 | 0x0255, /* Apple Wireless Keyboard US 2011 */
32 | 0x0257, /* Apple Wireless Keyboard JIS 2011 */
33 | 0x0265, /* Apple Magic Keyboard US 2015 */
34 | 0x0267, /* Apple Magic Keyboard JIS 2015 */
35 | };
36 | static BOOL IsSupportedDevice(WORD vid, WORD pid)
37 | {
38 | if (vid == VID_APPLE) {
39 | UINT i;
40 | for (i = 0; i < ARRAYSIZE(PID_APPLE_KEYBOARD); i++) {
41 | if (pid == PID_APPLE_KEYBOARD[i])
42 | return TRUE;
43 | }
44 | }
45 | return FALSE;
46 | }
47 |
48 | const struct AppIcon
49 | {
50 | LPCTSTR File;
51 | struct Index
52 | {
53 | WORD XP, Vista;
54 | } Index;
55 | } AppIcon =
56 | {
57 | TEXT("main.cpl"), { 7, 5 }
58 | };
59 |
60 | BOOL IsVistaOrGreater(void)
61 | {
62 | OSVERSIONINFOEX osvi;
63 | DWORDLONG condition = 0;
64 | ZeroMemory(&osvi, sizeof osvi);
65 | osvi.dwOSVersionInfoSize = sizeof osvi;
66 | osvi.dwMajorVersion = 6;
67 | VER_SET_CONDITION(condition, VER_MAJORVERSION, VER_GREATER_EQUAL);
68 | return VerifyVersionInfo(&osvi, VER_MAJORVERSION, condition);
69 | }
70 |
71 | enum
72 | {
73 | MY_EXTRA_INFO = 0x37564,
74 | };
75 | void SendKey(UINT vkCode)
76 | {
77 | INPUT inputs[2];
78 | ZeroMemory(inputs, sizeof inputs);
79 | inputs[0].type = INPUT_KEYBOARD;
80 | inputs[0].ki.wVk = (WORD)vkCode;
81 | inputs[0].ki.dwExtraInfo = MY_EXTRA_INFO;
82 |
83 | inputs[1].type = INPUT_KEYBOARD;
84 | inputs[1].ki.wVk = (WORD)vkCode;
85 | inputs[1].ki.dwFlags = KEYEVENTF_KEYUP;
86 | inputs[1].ki.dwExtraInfo = MY_EXTRA_INFO;
87 | SendInput(ARRAYSIZE(inputs), inputs, sizeof*inputs);
88 | }
89 |
90 | HRESULT WmiGetNamespace(BSTR strNamespace, IWbemServices **ppNamespace)
91 | {
92 | HRESULT hr;
93 | IWbemLocator *pLocator;
94 | hr = CoCreateInstance(&CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, &IID_IWbemLocator, (LPVOID *)&pLocator);
95 | if (hr != S_OK)
96 | return hr;
97 | hr = pLocator->lpVtbl->ConnectServer(pLocator, strNamespace, NULL, NULL, NULL, 0, NULL, NULL, ppNamespace);
98 | pLocator->lpVtbl->Release(pLocator);
99 | return hr;
100 | }
101 |
102 | HRESULT WmiQueryObject(IWbemServices *pNamespace, const BSTR strQuery, IWbemClassObject **ppObject)
103 | {
104 | HRESULT hr;
105 | IEnumWbemClassObject *pEnum;
106 | ULONG uReturned;
107 | hr = pNamespace->lpVtbl->ExecQuery(pNamespace, L"WQL", strQuery, WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnum);
108 | if (hr != S_OK)
109 | return hr;
110 | hr = pEnum->lpVtbl->Next(pEnum, WBEM_INFINITE, 1, ppObject, &uReturned);
111 | pEnum->lpVtbl->Release(pEnum);
112 | return hr;
113 | }
114 |
115 | HRESULT WmiCreateParams(IWbemServices *pNamespace, const BSTR strClass, const BSTR strMethod, IWbemClassObject **ppParams)
116 | {
117 | HRESULT hr;
118 | IWbemClassObject *pClass, *pMethod;
119 | hr = pNamespace->lpVtbl->GetObjectW(pNamespace, strClass, 0, NULL, &pClass, NULL);
120 | if (hr != S_OK)
121 | return hr;
122 | hr = pClass->lpVtbl->GetMethod(pClass, strMethod, 0, &pMethod, NULL);
123 | pClass->lpVtbl->Release(pClass);
124 | if (hr != S_OK)
125 | return hr;
126 | hr = pMethod->lpVtbl->SpawnInstance(pMethod, 0, ppParams);
127 | pMethod->lpVtbl->Release(pMethod);
128 | return hr;
129 | }
130 |
131 | HRESULT WmiExecMethod(IWbemServices *pNamespace, IWbemClassObject *pObject, const BSTR strMethod, IWbemClassObject *pParams)
132 | {
133 | HRESULT hr;
134 | VARIANT varObjectPath;
135 | hr = pObject->lpVtbl->Get(pObject, L"__PATH", 0, &varObjectPath, NULL, NULL);
136 | if (hr != S_OK)
137 | return hr;
138 | hr = pNamespace->lpVtbl->ExecMethod(pNamespace, varObjectPath.bstrVal, strMethod, 0, NULL, pParams, NULL, NULL);
139 | VariantClear(&varObjectPath);
140 | return hr;
141 | }
142 |
143 | void Power(void)
144 | {
145 | /* do nothing */
146 | }
147 |
148 | void Eject(void)
149 | {
150 | MCI_OPEN_PARMS mop;
151 | ZeroMemory(&mop, sizeof mop);
152 | mop.lpstrDeviceType = (LPCTSTR)MCI_DEVTYPE_CD_AUDIO;
153 | WinAPI.MCI.SendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID, (DWORD_PTR)&mop);
154 | WinAPI.MCI.SendCommand(mop.wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, 0);
155 | WinAPI.MCI.SendCommand(mop.wDeviceID, MCI_CLOSE, 0, 0);
156 | }
157 |
158 | void Flip3D(void)
159 | {
160 | INPUT inputs[4];
161 | ZeroMemory(inputs, sizeof inputs);
162 | inputs[0].type = INPUT_KEYBOARD;
163 | inputs[0].ki.wVk = VK_LWIN;
164 | inputs[0].ki.dwExtraInfo = MY_EXTRA_INFO;
165 |
166 | inputs[1].type = INPUT_KEYBOARD;
167 | inputs[1].ki.wVk = VK_TAB;
168 | inputs[1].ki.dwExtraInfo = MY_EXTRA_INFO;
169 |
170 | inputs[2].type = INPUT_KEYBOARD;
171 | inputs[2].ki.wVk = VK_TAB;
172 | inputs[2].ki.dwFlags = KEYEVENTF_KEYUP;
173 | inputs[2].ki.dwExtraInfo = MY_EXTRA_INFO;
174 |
175 | inputs[3].type = INPUT_KEYBOARD;
176 | inputs[3].ki.wVk = VK_LWIN;
177 | inputs[3].ki.dwFlags = KEYEVENTF_KEYUP;
178 | inputs[3].ki.dwExtraInfo = MY_EXTRA_INFO;
179 | SendInput(ARRAYSIZE(inputs), inputs, sizeof*inputs);
180 | }
181 |
182 | void Bright(int delta)
183 | {
184 | IWbemServices *pRootWmi;
185 | IWbemClassObject *pMonitorBrightness;
186 | IWbemClassObject *pMonitorBrightnessMethods, *pParams;
187 | VARIANT varCurrentBrightness, varTimeout, varBrightness;
188 | if (WmiGetNamespace(L"ROOT\\WMI", &pRootWmi) == S_OK) {
189 | if (WmiQueryObject(pRootWmi, L"Select * From WmiMonitorBrightness Where Active = True", &pMonitorBrightness) == S_OK) {
190 | if (pMonitorBrightness->lpVtbl->Get(pMonitorBrightness, L"CurrentBrightness", 0, &varCurrentBrightness, NULL, NULL) == S_OK) {
191 | if (WmiQueryObject(pRootWmi, L"Select * From WmiMonitorBrightnessMethods Where Active = True", &pMonitorBrightnessMethods) == S_OK) {
192 | if (WmiCreateParams(pRootWmi, L"WmiMonitorBrightnessMethods", L"WmiSetBrightness", &pParams) == S_OK) {
193 | varTimeout.vt = VT_I4, varTimeout.lVal = 0;
194 | varBrightness.vt = VT_UI1, varBrightness.bVal = addsb(varCurrentBrightness.bVal, delta);
195 | pParams->lpVtbl->Put(pParams, L"Timeout", 0, &varTimeout, CIM_UINT32);
196 | pParams->lpVtbl->Put(pParams, L"Brightness", 0, &varBrightness, CIM_UINT8);
197 | WmiExecMethod(pRootWmi, pMonitorBrightnessMethods, L"WmiSetBrightness", pParams);
198 | pParams->lpVtbl->Release(pParams);
199 | }
200 | pMonitorBrightnessMethods->lpVtbl->Release(pMonitorBrightnessMethods);
201 | }
202 | }
203 | pMonitorBrightness->lpVtbl->Release(pMonitorBrightness);
204 | }
205 | pRootWmi->lpVtbl->Release(pRootWmi);
206 | }
207 | }
208 |
209 | void Alpha(int delta)
210 | {
211 | HWND hWnd = GetForegroundWindow();
212 | DWORD xstyle = GetWindowLong(hWnd, GWL_EXSTYLE);
213 | BOOL layered = (xstyle & WS_EX_LAYERED);
214 | if (!layered) {
215 | if (delta < 0) {
216 | SetWindowLong(hWnd, GWL_EXSTYLE, xstyle | WS_EX_LAYERED);
217 | SetLayeredWindowAttributes(hWnd, 0, addsb(0xFF, delta), LWA_ALPHA);
218 | }
219 | } else {
220 | BYTE alpha, a;
221 | DWORD flags;
222 | if (!GetLayeredWindowAttributes(hWnd, NULL, &alpha, &flags) || !(flags & LWA_ALPHA))
223 | alpha = 0xFF;
224 | SetLayeredWindowAttributes(hWnd, 0, a = addsb(alpha, delta), LWA_ALPHA);
225 | if (a == 0xFF)
226 | SetWindowLong(hWnd, GWL_EXSTYLE, xstyle & ~WS_EX_LAYERED);
227 | }
228 | }
229 |
230 | void Exec(LPCTSTR cmd)
231 | {
232 | ShellExecute(NULL, NULL, cmd, NULL, NULL, SW_SHOWNORMAL);
233 | }
234 |
235 |
236 | static struct Config config;
237 | static TCHAR config_szCmds[ARRAYSIZE(config.cbCmds)][80];
238 | static void Config_Initialize(void)
239 | {
240 | /* single action keys */
241 | config.Key.Power = CONFIG_INIT_KEY_POWER;
242 | config.Key.Eject = CONFIG_INIT_KEY_EJECT;
243 | config.Key.Alnum = CONFIG_INIT_KEY_ALNUM;
244 | config.Key.Kana = CONFIG_INIT_KEY_KANA;
245 | /* Fn combination keys */
246 | config.Fn.F1 = CONFIG_INIT_FN_F1;
247 | config.Fn.F2 = CONFIG_INIT_FN_F2;
248 | config.Fn.F3 = CONFIG_INIT_FN_F3;
249 | config.Fn.F4 = CONFIG_INIT_FN_F4;
250 | config.Fn.F5 = CONFIG_INIT_FN_F5;
251 | config.Fn.F6 = CONFIG_INIT_FN_F6;
252 | config.Fn.F7 = CONFIG_INIT_FN_F7;
253 | config.Fn.F8 = CONFIG_INIT_FN_F8;
254 | config.Fn.F9 = CONFIG_INIT_FN_F9;
255 | config.Fn.F10 = CONFIG_INIT_FN_F10;
256 | config.Fn.F11 = CONFIG_INIT_FN_F11;
257 | config.Fn.F12 = CONFIG_INIT_FN_F12;
258 | config.Fn.Del = CONFIG_INIT_FN_DEL;
259 | config.Fn.Up = CONFIG_INIT_FN_UP;
260 | config.Fn.Down = CONFIG_INIT_FN_DOWN;
261 | config.Fn.Left = CONFIG_INIT_FN_LEFT;
262 | config.Fn.Right = CONFIG_INIT_FN_RIGHT;
263 | config.Fn.Eject = CONFIG_INIT_FN_EJECT;
264 | /* external commands */
265 | ZeroMemory(config.cbCmds, sizeof config.cbCmds);
266 | ZeroMemory(config_szCmds, sizeof config_szCmds);
267 | }
268 | static void Config_Load(void)
269 | {
270 | TCHAR szFile[MAX_PATH];
271 | HANDLE hFile;
272 | DWORD r, i;
273 | struct Config conf;
274 |
275 | r = GetModuleFileName(NULL, szFile, ARRAYSIZE(szFile));
276 | lstrcpy(szFile + r - 3, TEXT("cf"));
277 |
278 | hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
279 | if (hFile == INVALID_HANDLE_VALUE)
280 | return;
281 | if (ReadFile(hFile, &conf, sizeof conf, &r, NULL) && r == sizeof conf) {
282 | if (conf.Signature == CONFIG_SIGNATURE) {
283 | for (i = 0; i < ARRAYSIZE(conf.cbCmds); i++) {
284 | ZeroMemory(config_szCmds[i], ARRAYSIZE(config_szCmds[i]));
285 | if (conf.cbCmds[i] < ARRAYSIZE(config_szCmds[0]))
286 | ReadFile(hFile, config_szCmds[i], sizeof(TCHAR) * conf.cbCmds[i], &r, NULL);
287 | }
288 | config = conf;
289 | }
290 | }
291 | CloseHandle(hFile);
292 | }
293 |
294 | static struct Status
295 | {
296 | BOOL Fn;
297 | } Status;
298 | static void Status_Initialize(void)
299 | {
300 | ZeroMemory(&Status, sizeof Status);
301 | }
302 |
303 | struct Global
304 | {
305 | HHOOK hHook;
306 | HICON hIconLarge;
307 | HICON hIconSmall;
308 | } Global;
309 | void Global_Initialize(void)
310 | {
311 | Global.hHook = NULL;
312 | Global.hIconLarge = NULL;
313 | Global.hIconSmall = NULL;
314 | }
315 |
316 | enum
317 | {
318 | FALL_THROUGH = 0, FIRED,
319 | };
320 | static UINT Fire(UINT what)
321 | {
322 | switch (what) {
323 | case 0:
324 | return FALL_THROUGH;
325 | case FIRE_NOTHING:
326 | break;
327 | case FIRE_POWER:
328 | Power();
329 | break;
330 | case FIRE_EJECT:
331 | Eject();
332 | break;
333 | case FIRE_FLIP3D:
334 | Flip3D();
335 | break;
336 | case FIRE_BRIGHT_DN:
337 | Bright(-BRIGHT_STEP);
338 | break;
339 | case FIRE_BRIGHT_UP:
340 | Bright(+BRIGHT_STEP);
341 | break;
342 | case FIRE_ALPHA_DN:
343 | Alpha(-ALPHA_DELTA);
344 | break;
345 | case FIRE_ALPHA_UP:
346 | Alpha(+ALPHA_DELTA);
347 | break;
348 | default:
349 | if (FIRE_CMD_0 <= what && what < FIRE_CMD_0 + ARRAYSIZE(config_szCmds))
350 | Exec(config_szCmds[what - FIRE_CMD_0]);
351 | else
352 | SendKey(what);
353 | }
354 | return FIRED;
355 | }
356 |
357 | static UINT OnKeyDown(DWORD vkCode)
358 | {
359 | if (Status.Fn) {
360 | switch (vkCode) {
361 | case VK_BACK : return Fire(config.Fn.Del );
362 | case VK_UP : return Fire(config.Fn.Up );
363 | case VK_DOWN : return Fire(config.Fn.Down );
364 | case VK_LEFT : return Fire(config.Fn.Left );
365 | case VK_RIGHT: return Fire(config.Fn.Right);
366 | case VK_F1 : return Fire(config.Fn.F1 );
367 | case VK_F2 : return Fire(config.Fn.F2 );
368 | case VK_F3 : return Fire(config.Fn.F3 );
369 | case VK_F4 : return Fire(config.Fn.F4 );
370 | case VK_F5 : return Fire(config.Fn.F5 );
371 | case VK_F6 : return Fire(config.Fn.F6 );
372 | case VK_F7 : return Fire(config.Fn.F7 );
373 | case VK_F8 : return Fire(config.Fn.F8 );
374 | case VK_F9 : return Fire(config.Fn.F9 );
375 | case VK_F10 : return Fire(config.Fn.F10 );
376 | case VK_F11 : return Fire(config.Fn.F11 );
377 | case VK_F12 : return Fire(config.Fn.F12 );
378 | }
379 | }
380 | return FALL_THROUGH;
381 | }
382 |
383 | enum
384 | {
385 | SCANCODE_ALNUM = 113,
386 | SCANCODE_KANA = 114,
387 | };
388 | static UINT OnScanUp(DWORD scanCode)
389 | {
390 | switch (scanCode) {
391 | case SCANCODE_ALNUM: return Fire(config.Key.Alnum);
392 | case SCANCODE_KANA : return Fire(config.Key.Kana );
393 | }
394 | return FALL_THROUGH;
395 | }
396 |
397 | enum /* Apple Special Keys bitfield */
398 | {
399 | SPECIAL_EJECT_MASK = 0x08, SPECIAL_EJECT_ON = 0x08,
400 | SPECIAL_FN_MASK = 0x10, SPECIAL_FN_ON = 0x10,
401 | };
402 | static void OnSpecial(UINT state)
403 | {
404 | Status.Fn = (state & SPECIAL_FN_MASK) == SPECIAL_FN_ON;
405 | if ((state & SPECIAL_EJECT_MASK) == SPECIAL_EJECT_ON) {
406 | if (Status.Fn)
407 | Fire(config.Fn.Eject);
408 | else
409 | Fire(config.Key.Eject);
410 | }
411 | }
412 |
413 | static void OnPower(BOOL power)
414 | {
415 | if (power)
416 | Fire(config.Key.Power);
417 | }
418 |
419 | static LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
420 | {
421 | if (nCode < 0)
422 | return CallNextHookEx(Global.hHook, nCode, wParam, lParam);
423 | if (nCode == HC_ACTION) {
424 | LPKBDLLHOOKSTRUCT pkbs = (LPKBDLLHOOKSTRUCT)lParam;
425 | switch (pkbs->vkCode) {
426 | case VK_LSHIFT:
427 | case VK_RSHIFT:
428 | case VK_LMENU:
429 | case VK_RMENU:
430 | case VK_LCONTROL:
431 | case VK_RCONTROL:
432 | return CallNextHookEx(Global.hHook, nCode, wParam, lParam);
433 | }
434 | if (pkbs->dwExtraInfo == MY_EXTRA_INFO)
435 | return CallNextHookEx(Global.hHook, nCode, wParam, lParam);
436 |
437 | switch (wParam) {
438 | case WM_KEYDOWN:
439 | case WM_SYSKEYDOWN:
440 | if (OnKeyDown(pkbs->vkCode))
441 | return TRUE;
442 | break;
443 | case WM_KEYUP:
444 | if (OnScanUp(pkbs->scanCode))
445 | return TRUE;
446 | break;
447 | }
448 | }
449 | return CallNextHookEx(Global.hHook, nCode, wParam, lParam);
450 | }
451 |
452 | enum
453 | {
454 | RETRY_INTERVAL = 10 * 1000 /* 10sec */
455 | };
456 | static DWORD CALLBACK SpecialKey_Thread(LPVOID);
457 | static struct SpecialKey
458 | {
459 | HANDLE hDevice;
460 | HANDLE hThread;
461 | HANDLE evTerm;
462 | HANDLE evDone;
463 | BYTE buffer[22];
464 | OVERLAPPED overlapped;
465 | } SpecialKey;
466 | static void SpecialKey_Initialize(void)
467 | {
468 | SpecialKey.hDevice = INVALID_HANDLE_VALUE;
469 | SpecialKey.hThread = NULL;
470 | SpecialKey.evTerm = NULL;
471 | SpecialKey.evDone = NULL;
472 | }
473 | static BOOL SpecialKey_Prepare(void)
474 | {
475 | GUID guid;
476 | HDEVINFO hDevInfo;
477 | SP_DEVICE_INTERFACE_DATA diData;
478 | DWORD index;
479 |
480 | if (SpecialKey.hDevice != INVALID_HANDLE_VALUE)
481 | return TRUE;
482 |
483 | WinAPI.HID.GetHidGuid(&guid);
484 | hDevInfo = WinAPI.Setup.GetClassDevs(&guid, NULL, NULL, DIGCF_DEVICEINTERFACE);
485 | if (!hDevInfo)
486 | return FALSE;
487 | diData.cbSize = sizeof diData;
488 | for (index = 0;
489 | WinAPI.Setup.EnumDeviceInterfaces(hDevInfo, NULL, &guid, index, &diData);
490 | index++)
491 | {
492 | BYTE diDetailImpl[sizeof(DWORD) + sizeof(TCHAR) * MAX_PATH];
493 | PSP_DEVICE_INTERFACE_DETAIL_DATA pdiDetail;
494 | DWORD sizeDetail;
495 |
496 | pdiDetail = (PSP_DEVICE_INTERFACE_DETAIL_DATA)diDetailImpl;
497 | pdiDetail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
498 | if (WinAPI.Setup.GetDeviceInterfaceDetail(hDevInfo,
499 | &diData, pdiDetail, sizeof diDetailImpl, &sizeDetail, NULL))
500 | {
501 | HIDD_ATTRIBUTES attr;
502 | HANDLE hDevice = CreateFile(pdiDetail->DevicePath,
503 | GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
504 | NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
505 | if (hDevice == INVALID_HANDLE_VALUE)
506 | continue;
507 | attr.Size = sizeof attr;
508 | if (WinAPI.HID.GetAttributes(hDevice, &attr) &&
509 | IsSupportedDevice(attr.VenderID, attr.ProductID))
510 | {
511 | /* use last one */
512 | if (SpecialKey.hDevice != INVALID_HANDLE_VALUE)
513 | CloseHandle(SpecialKey.hDevice);
514 | SpecialKey.hDevice = hDevice;
515 | }
516 | if (hDevice != SpecialKey.hDevice)
517 | CloseHandle(hDevice);
518 | }
519 | }
520 | WinAPI.Setup.DestroyDeviceInfoList(hDevInfo);
521 |
522 | if (SpecialKey.hThread != NULL)
523 | return TRUE;
524 | if (SpecialKey.hDevice != INVALID_HANDLE_VALUE) {
525 | if ((SpecialKey.evTerm = CreateEvent(NULL, TRUE, FALSE, NULL)) != NULL &&
526 | (SpecialKey.evDone = CreateEvent(NULL, TRUE, FALSE, NULL)) != NULL)
527 | {
528 | SpecialKey.hThread = CreateThread(NULL, 0, SpecialKey_Thread, NULL, 0, NULL);
529 | if (SpecialKey.hThread != NULL)
530 | return TRUE;
531 | }
532 | CloseHandle(SpecialKey.evTerm);
533 | CloseHandle(SpecialKey.evDone);
534 | CloseHandle(SpecialKey.hDevice);
535 | SpecialKey_Initialize();
536 | }
537 | return FALSE;
538 | }
539 | static void SpecialKey_Cleanup(void)
540 | {
541 | if (SpecialKey.hThread) {
542 | SetEvent(SpecialKey.evTerm);
543 | WaitForSingleObject(SpecialKey.evDone, INFINITE);
544 | CloseHandle(SpecialKey.evTerm);
545 | CloseHandle(SpecialKey.evDone);
546 | CloseHandle(SpecialKey.hThread);
547 | }
548 | SpecialKey_Initialize();
549 |
550 | /* reset special key status */
551 | Status_Initialize();
552 | }
553 | static DWORD CALLBACK SpecialKey_Thread(LPVOID lpParam)
554 | {
555 | HANDLE evts[2];
556 |
557 | UNREFERENCED_PARAMETER(lpParam);
558 |
559 | ZeroMemory(&SpecialKey.overlapped, sizeof SpecialKey.overlapped);
560 | SpecialKey.overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
561 |
562 | evts[0] = SpecialKey.overlapped.hEvent;
563 | evts[1] = SpecialKey.evTerm;
564 | for (;;) {
565 | DWORD r;
566 | ResetEvent(SpecialKey.overlapped.hEvent);
567 | SpecialKey.overlapped.Offset = SpecialKey.overlapped.OffsetHigh = 0;
568 | if (!ReadFile(SpecialKey.hDevice, SpecialKey.buffer, sizeof SpecialKey.buffer,
569 | &r, &SpecialKey.overlapped))
570 | {
571 | if (GetLastError() != ERROR_IO_PENDING) {
572 | /* disconnected */
573 | CloseHandle(SpecialKey.hDevice);
574 | SpecialKey.hDevice = INVALID_HANDLE_VALUE;
575 | for (;;) {
576 | if (SpecialKey_Prepare())
577 | break;
578 | if (WaitForSingleObject(SpecialKey.evTerm, RETRY_INTERVAL) != WAIT_TIMEOUT)
579 | goto term;
580 | }
581 | continue;
582 | }
583 | if (WaitForMultipleObjects(ARRAYSIZE(evts), evts, FALSE, INFINITE) != WAIT_OBJECT_0)
584 | break;
585 | }
586 |
587 | switch (SpecialKey.buffer[0]) {
588 | case 0x11:
589 | OnSpecial(SpecialKey.buffer[1]);
590 | break;
591 | case 0x13:
592 | OnPower(SpecialKey.buffer[1] == 1);
593 | break;
594 | }
595 | }
596 | CancelIo(SpecialKey.hDevice);
597 | CloseHandle(SpecialKey.hDevice);
598 | SpecialKey.hDevice = INVALID_HANDLE_VALUE;
599 |
600 | term:
601 | CloseHandle(SpecialKey.overlapped.hEvent);
602 |
603 | SetEvent(SpecialKey.evDone);
604 | return 0;
605 | }
606 |
607 | static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
608 | {
609 | enum
610 | {
611 | WM_APP_TRAYICON = WM_APP_RELOAD + 1,
612 | };
613 | static NOTIFYICONDATA nid;
614 | static HMENU hMenu;
615 |
616 | switch (uMsg) {
617 | case WM_APP_TRAYICON:
618 | switch (lParam) {
619 | case WM_RBUTTONDOWN:
620 | SetCapture(hWnd);
621 | break;
622 | case WM_RBUTTONUP:
623 | ReleaseCapture();
624 | {
625 | RECT rc;
626 | POINT pt;
627 | GetCursorPos(&pt);
628 | GetWindowRect(GetDesktopWindow(), &rc);
629 | SetForegroundWindow(hWnd);
630 | TrackPopupMenu(GetSubMenu(hMenu, 0),
631 | (pt.x < (rc.left + rc.right) / 2 ? TPM_LEFTALIGN : TPM_RIGHTALIGN) |
632 | (pt.y < (rc.top + rc.bottom) / 2 ? TPM_TOPALIGN : TPM_BOTTOMALIGN) |
633 | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hWnd, NULL);
634 | PostMessage(hWnd, WM_NULL, 0, 0);
635 | }
636 | break;
637 | case NIN_BALLOONHIDE:
638 | case NIN_BALLOONTIMEOUT:
639 | case NIN_BALLOONUSERCLICK:
640 | /* error message closed */
641 | DestroyWindow(hWnd);
642 | break;
643 | }
644 | return 0;
645 | case WM_APP_RELOAD:
646 | {
647 | Config_Load();
648 | }
649 | return 0;
650 | case WM_COMMAND:
651 | switch (LOWORD(wParam)) {
652 | case ID_CONF:
653 | {
654 | TCHAR cmd[MAX_PATH];
655 | GetModuleFileName(NULL, cmd, ARRAYSIZE(cmd));
656 | lstrcpy(cmd + lstrlen(cmd) - 4, TEXT("cf"));
657 | Exec(cmd);
658 | }
659 | break;
660 | case ID_QUIT:
661 | DestroyWindow(hWnd);
662 | break;
663 | }
664 | break;
665 | case WM_CREATE:
666 | {
667 | HINSTANCE hInstance = ((LPCREATESTRUCT)lParam)->hInstance;
668 |
669 | Config_Load();
670 |
671 | /* menu */
672 | hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDM_MAIN));
673 |
674 | /* tray icon */
675 | ZeroMemory(&nid, sizeof nid);
676 | nid.cbSize = sizeof nid;
677 | nid.hWnd = hWnd;
678 | nid.uID = 100;
679 | nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
680 | nid.uCallbackMessage = WM_APP_TRAYICON;
681 | nid.hIcon = Global.hIconLarge;
682 | lstrcpy(nid.szTip, App.Title);
683 | Shell_NotifyIcon(NIM_ADD, &nid);
684 | /* error message balloon tip */
685 | nid.uFlags = NIF_INFO;
686 | nid.dwInfoFlags = NIIF_WARNING;
687 | LoadString(hInstance, IDS_DEVICE_NOT_FOUND, nid.szInfo, ARRAYSIZE(nid.szInfo));
688 | lstrcpy(nid.szInfoTitle, App.Title);
689 |
690 | /* low level keyboard hook */
691 | Global.hHook = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, hInstance, 0);
692 |
693 | if (!SpecialKey_Prepare())
694 | Shell_NotifyIcon(NIM_MODIFY, &nid);
695 | }
696 | break;
697 | case WM_DESTROY:
698 | {
699 | SpecialKey_Cleanup();
700 | UnhookWindowsHookEx(Global.hHook);
701 | Shell_NotifyIcon(NIM_DELETE, &nid);
702 | DestroyMenu(hMenu);
703 | }
704 | PostQuitMessage(0);
705 | return 0;
706 | }
707 | return DefWindowProc(hWnd, uMsg, wParam, lParam);
708 | }
709 |
710 | int Main(HINSTANCE hInstance)
711 | {
712 | WNDCLASSEX wcx;
713 | HWND wnd;
714 | MSG msg;
715 |
716 | if ((wnd = FindWindow(App.Class, App.Title)) != NULL) {
717 | /* reload config */
718 | PostMessage(wnd, WM_APP_RELOAD, 0, 0);
719 | return 0;
720 | }
721 |
722 | CoInitializeEx(0, COINIT_MULTITHREADED);
723 | CoInitializeSecurity(NULL, -1, NULL, NULL,
724 | RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
725 | WinAPI_Initialize();
726 | Global_Initialize();
727 | Status_Initialize();
728 | Config_Initialize();
729 |
730 | SpecialKey_Initialize();
731 |
732 | ExtractIconEx(AppIcon.File, IsVistaOrGreater() ? AppIcon.Index.Vista : AppIcon.Index.XP,
733 | &Global.hIconLarge, &Global.hIconSmall, 1);
734 |
735 | ZeroMemory(&wcx, sizeof wcx);
736 | wcx.cbSize = sizeof wcx;
737 | wcx.style = CS_NOCLOSE;
738 | wcx.lpfnWndProc = WndProc;
739 | wcx.hInstance = hInstance;
740 | wcx.hCursor = (HCURSOR)LoadImage(NULL, IDC_ARROW,
741 | IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED);
742 | wcx.lpszClassName = App.Class;
743 | wcx.hIcon = Global.hIconLarge;
744 | wcx.hIconSm = Global.hIconSmall;
745 | RegisterClassEx(&wcx);
746 | CreateWindowEx(0, wcx.lpszClassName, App.Title, WS_POPUP,
747 | CW_USEDEFAULT, 0, 10, 10, NULL, NULL, wcx.hInstance, NULL);
748 | while (GetMessage(&msg, NULL, 0, 0)) {
749 | TranslateMessage(&msg);
750 | DispatchMessage(&msg);
751 | }
752 | DestroyIcon(Global.hIconLarge);
753 | DestroyIcon(Global.hIconSmall);
754 |
755 | WinAPI_Uninitialize();
756 | CoUninitialize();
757 | return (int)msg.wParam;
758 | }
759 |
760 | #ifndef NDEBUG
761 | int APIENTRY _tWinMain(HINSTANCE hInstance,
762 | HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
763 | {
764 | UNREFERENCED_PARAMETER(hPrevInstance);
765 | UNREFERENCED_PARAMETER(lpCmdLine);
766 | UNREFERENCED_PARAMETER(nCmdShow);
767 | return Main(hInstance);
768 | }
769 | #else
770 | void Startup(void)
771 | {
772 | ExitProcess(Main(GetModuleHandle(NULL)));
773 | }
774 | #endif
775 |
--------------------------------------------------------------------------------
/akb/akb.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andantissimo/Apple-Keyboard-Bridge/58a26d10f145d0a47b1079ce724fd120ae619406/akb/akb.rc
--------------------------------------------------------------------------------
/akb/akb.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {8002A1D9-681D-4D65-B04D-8BBF9E4435E9}
15 | akb
16 | Win32Proj
17 | 8.1
18 |
19 |
20 |
21 | Application
22 | v141_xp
23 | Unicode
24 | true
25 |
26 |
27 | Application
28 | v141_xp
29 | Unicode
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | <_ProjectFileVersion>14.0.23107.0
43 |
44 |
45 | $(SolutionDir)bin\$(Configuration)\
46 | $(SolutionDir)obj\$(Configuration)\$(ProjectName)\
47 | true
48 | false
49 |
50 |
51 | $(SolutionDir)bin\$(Configuration)\
52 | $(SolutionDir)obj\$(Configuration)\$(ProjectName)\
53 | false
54 | false
55 |
56 |
57 |
58 | $(IntDir)$(ProjectName).htm
59 |
60 |
61 | Disabled
62 | WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
63 | true
64 | EnableFastChecks
65 | MultiThreadedDebug
66 | true
67 | false
68 |
69 | $(IntDir)$(TargetName).pdb
70 | Level4
71 | ProgramDatabase
72 | Default
73 | false
74 |
75 |
76 | true
77 | Windows
78 | MachineX86
79 | %(AdditionalDependencies)
80 |
81 |
82 |
83 |
84 | $(IntDir)$(ProjectName).htm
85 |
86 |
87 | MinSpace
88 | false
89 | Size
90 | true
91 | true
92 | WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
93 | true
94 | false
95 | MultiThreaded
96 | false
97 | true
98 | false
99 |
100 | $(IntDir)$(TargetName).pdb
101 | Level4
102 | ProgramDatabase
103 | Default
104 |
105 |
106 | /merge:.rdata=.text %(AdditionalOptions)
107 | true
108 | false
109 | Windows
110 | true
111 | true
112 | Startup
113 | false
114 | true
115 | MachineX86
116 | %(AdditionalDependencies)
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 | {1d163a1a-d710-4964-a1f8-8d332df5b02c}
132 | false
133 |
134 |
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/akb/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by akb.rc
4 | //
5 | #define IDS_DEVICE_NOT_FOUND 101
6 | #define IDM_MAIN 102
7 | #define ID_QUIT 40001
8 | #define ID_CONF 40002
9 |
10 | // Next default values for new objects
11 | //
12 | #ifdef APSTUDIO_INVOKED
13 | #ifndef APSTUDIO_READONLY_SYMBOLS
14 | #define _APS_NEXT_RESOURCE_VALUE 103
15 | #define _APS_NEXT_COMMAND_VALUE 40003
16 | #define _APS_NEXT_CONTROL_VALUE 1001
17 | #define _APS_NEXT_SYMED_VALUE 101
18 | #endif
19 | #endif
20 |
--------------------------------------------------------------------------------
/akb/winapi.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Apple Keyboard Bridge https://github.com/andantissimo/Apple-Keyboard-Bridge
3 | */
4 | #pragma once
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | #ifdef UNICODE
12 | #define WINAPI_SUFFIX "W"
13 | #else
14 | #define WINAPI_SUFFIX "A"
15 | #endif
16 |
17 | #ifdef NDEBUG
18 | #ifdef RtlZeroMemory
19 | #undef RtlZeroMemory
20 | EXTERN_C VOID WINAPI RtlZeroMemory(LPVOID, DWORD);
21 | #endif
22 | #endif
23 |
24 | #pragma pack(push, 1)
25 |
26 | typedef struct HIDD_ATTRIBUTES
27 | {
28 | DWORD Size;
29 | WORD VenderID;
30 | WORD ProductID;
31 | WORD VersionNumber;
32 | } HIDD_ATTRIBUTES;
33 |
34 | #define PHYSICAL_MONITOR_DESCRIPTION_SIZE 128
35 |
36 | typedef struct PHYSICAL_MONITOR
37 | {
38 | HANDLE hPhysicalMonitor;
39 | WCHAR szPhysicalMonitorDescription[PHYSICAL_MONITOR_DESCRIPTION_SIZE];
40 | } PHYSICAL_MONITOR;
41 |
42 | #pragma pack(pop)
43 |
44 | static struct WinAPI
45 | {
46 | struct Setup
47 | {
48 | HMODULE hDLL;
49 | HDEVINFO (WINAPI *GetClassDevs)(LPGUID, PCSTR, HWND, DWORD);
50 | BOOL (WINAPI *DestroyDeviceInfoList)(HDEVINFO);
51 | BOOL (WINAPI *EnumDeviceInterfaces)(HDEVINFO, PSP_DEVINFO_DATA,
52 | LPGUID, DWORD, PSP_DEVICE_INTERFACE_DATA);
53 | BOOL (WINAPI *GetDeviceInterfaceDetail)(HDEVINFO, PSP_DEVICE_INTERFACE_DATA,
54 | PSP_DEVICE_INTERFACE_DETAIL_DATA,
55 | DWORD, PDWORD, PSP_DEVINFO_DATA);
56 | } Setup;
57 |
58 | struct HID
59 | {
60 | HMODULE hDLL;
61 | VOID (WINAPI *GetHidGuid)(LPGUID);
62 | BOOLEAN (WINAPI *GetAttributes)(HANDLE, HIDD_ATTRIBUTES *);
63 | BOOLEAN (WINAPI *GetInputReport)(HANDLE, LPVOID, DWORD);
64 | } HID;
65 |
66 | struct MCI
67 | {
68 | HMODULE hDLL;
69 | MCIERROR (WINAPI *SendCommand)(MCIDEVICEID, UINT, DWORD, DWORD_PTR);
70 | } MCI;
71 | } WinAPI;
72 |
73 | void WinAPI_Initialize(void)
74 | {
75 | #define PROC_(p) *(FARPROC *)&(p)
76 |
77 | WinAPI.Setup.hDLL = LoadLibrary(TEXT("setupapi.dll"));
78 | PROC_(WinAPI.Setup.GetClassDevs)
79 | = GetProcAddress(WinAPI.Setup.hDLL, "SetupDiGetClassDevs" WINAPI_SUFFIX);
80 | PROC_(WinAPI.Setup.DestroyDeviceInfoList)
81 | = GetProcAddress(WinAPI.Setup.hDLL, "SetupDiDestroyDeviceInfoList");
82 | PROC_(WinAPI.Setup.EnumDeviceInterfaces)
83 | = GetProcAddress(WinAPI.Setup.hDLL, "SetupDiEnumDeviceInterfaces");
84 | PROC_(WinAPI.Setup.GetDeviceInterfaceDetail)
85 | = GetProcAddress(WinAPI.Setup.hDLL, "SetupDiGetDeviceInterfaceDetail" WINAPI_SUFFIX);
86 |
87 | WinAPI.HID.hDLL = LoadLibrary(TEXT("hid.dll"));
88 | PROC_(WinAPI.HID.GetHidGuid)
89 | = GetProcAddress(WinAPI.HID.hDLL, "HidD_GetHidGuid");
90 | PROC_(WinAPI.HID.GetAttributes)
91 | = GetProcAddress(WinAPI.HID.hDLL, "HidD_GetAttributes");
92 |
93 | WinAPI.MCI.hDLL = LoadLibrary(TEXT("winmm.dll"));
94 | PROC_(WinAPI.MCI.SendCommand)
95 | = GetProcAddress(WinAPI.MCI.hDLL, "mciSendCommand" WINAPI_SUFFIX);
96 |
97 | #undef PROC_
98 | }
99 |
100 | void WinAPI_Uninitialize(void)
101 | {
102 | FreeLibrary(WinAPI.Setup.hDLL);
103 | FreeLibrary(WinAPI.HID.hDLL);
104 | FreeLibrary(WinAPI.MCI.hDLL);
105 | }
106 |
--------------------------------------------------------------------------------
/akbcf/AssemblyInfo.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Apple Keyboard Bridge https://github.com/andantissimo/Apple-Keyboard-Bridge
3 | */
4 | using namespace System;
5 | using namespace System::Reflection;
6 | using namespace System::Runtime::CompilerServices;
7 | using namespace System::Runtime::InteropServices;
8 | using namespace System::Security::Permissions;
9 |
10 | [assembly:AssemblyTitleAttribute("Apple Keyboard Bridge - Configuration Editor")];
11 | [assembly:AssemblyDescriptionAttribute("")];
12 | [assembly:AssemblyConfigurationAttribute("")];
13 | [assembly:AssemblyCompanyAttribute("MALU")];
14 | [assembly:AssemblyProductAttribute("")];
15 | [assembly:AssemblyCopyrightAttribute("Copyright (C) 2011-2015 MALU")];
16 | [assembly:AssemblyTrademarkAttribute("")];
17 | [assembly:AssemblyCultureAttribute("")];
18 | [assembly:AssemblyVersionAttribute("0.1.3")];
19 |
20 | [assembly:ComVisible(false)];
21 | [assembly:CLSCompliantAttribute(true)];
22 |
--------------------------------------------------------------------------------
/akbcf/EditForm.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Apple Keyboard Bridge https://github.com/andantissimo/Apple-Keyboard-Bridge
3 | */
4 | #include "EditForm.h"
5 |
6 | #include "acl.h"
7 |
8 | using namespace System;
9 | using namespace System::ComponentModel;
10 | using namespace System::Collections::Generic;
11 | using namespace System::Windows::Forms;
12 | using namespace System::Drawing;
13 | using namespace System::IO;
14 | using namespace System::Diagnostics;
15 | using namespace System::Runtime::InteropServices;
16 |
17 | namespace akbcf
18 | {
19 | ref class ScopedFlag sealed
20 | {
21 | Boolean^ _ref;
22 | Boolean _val;
23 | public:
24 | explicit ScopedFlag(Boolean^ flag)
25 | : _ref(flag), _val(*flag)
26 | {
27 | _ref = true;
28 | }
29 | ~ScopedFlag()
30 | {
31 | _ref = _val;
32 | }
33 | };
34 |
35 | static void Config_SetDefaults(Config^ config)
36 | {
37 | config->Signature = CONFIG_SIGNATURE;
38 | /* single action keys */
39 | config->Key.Power = CONFIG_INIT_KEY_POWER;
40 | config->Key.Eject = CONFIG_INIT_KEY_EJECT;
41 | config->Key.Alnum = CONFIG_INIT_KEY_ALNUM;
42 | config->Key.Kana = CONFIG_INIT_KEY_KANA;
43 | /* Fn combination keys */
44 | config->Fn.F1 = CONFIG_INIT_FN_F1;
45 | config->Fn.F2 = CONFIG_INIT_FN_F2;
46 | config->Fn.F3 = CONFIG_INIT_FN_F3;
47 | config->Fn.F4 = CONFIG_INIT_FN_F4;
48 | config->Fn.F5 = CONFIG_INIT_FN_F5;
49 | config->Fn.F6 = CONFIG_INIT_FN_F6;
50 | config->Fn.F7 = CONFIG_INIT_FN_F7;
51 | config->Fn.F8 = CONFIG_INIT_FN_F8;
52 | config->Fn.F9 = CONFIG_INIT_FN_F9;
53 | config->Fn.F10 = CONFIG_INIT_FN_F10;
54 | config->Fn.F11 = CONFIG_INIT_FN_F11;
55 | config->Fn.F12 = CONFIG_INIT_FN_F12;
56 | config->Fn.Del = CONFIG_INIT_FN_DEL;
57 | config->Fn.Up = CONFIG_INIT_FN_UP;
58 | config->Fn.Down = CONFIG_INIT_FN_DOWN;
59 | config->Fn.Left = CONFIG_INIT_FN_LEFT;
60 | config->Fn.Right = CONFIG_INIT_FN_RIGHT;
61 | config->Fn.Eject = CONFIG_INIT_FN_EJECT;
62 | /* length of command */
63 | config->cbCmds = gcnew array(CONFIG_NUM_CMDS);
64 | }
65 |
66 | void EditForm::LoadResources()
67 | {
68 | // Key code => Key name
69 | this->InputKeys = gcnew Dictionary();
70 | this->InputKeys[VK_F13 ] = L"F13";
71 | this->InputKeys[VK_F14 ] = L"F14";
72 | this->InputKeys[VK_F15 ] = L"F15";
73 | this->InputKeys[VK_F16 ] = L"F16";
74 | this->InputKeys[VK_F17 ] = L"F17";
75 | this->InputKeys[VK_F18 ] = L"F18";
76 | this->InputKeys[VK_F19 ] = L"F19";
77 | this->InputKeys[VK_F20 ] = L"F20";
78 | this->InputKeys[VK_F21 ] = L"F21";
79 | this->InputKeys[VK_F22 ] = L"F22";
80 | this->InputKeys[VK_F23 ] = L"F23";
81 | this->InputKeys[VK_F24 ] = L"F24";
82 | this->InputKeys[VK_INSERT ] = L"Insert";
83 | this->InputKeys[VK_DELETE ] = L"Delete";
84 | this->InputKeys[VK_HOME ] = L"Home";
85 | this->InputKeys[VK_END ] = L"End";
86 | this->InputKeys[VK_PRIOR ] = L"Page Up";
87 | this->InputKeys[VK_NEXT ] = L"Page Down";
88 | this->InputKeys[VK_KANJI ] = L"半角/全角";
89 | this->InputKeys[VK_NONCONVERT ] = L"無変換";
90 | this->InputKeys[VK_CONVERT ] = L"変換";
91 | this->InputKeys[VK_SNAPSHOT ] = L"Print Screen";
92 | this->InputKeys[VK_BROWSER_BACK ] = L"戻る";
93 | this->InputKeys[VK_BROWSER_FORWARD ] = L"進む";
94 | this->InputKeys[VK_BROWSER_REFRESH ] = L"更新";
95 | this->InputKeys[VK_BROWSER_STOP ] = L"中止";
96 | this->InputKeys[VK_BROWSER_SEARCH ] = L"検索";
97 | this->InputKeys[VK_BROWSER_FAVORITES] = L"お気に入り";
98 | this->InputKeys[VK_BROWSER_HOME ] = L"ホームページ";
99 | this->InputKeys[VK_VOLUME_MUTE ] = L"ミュート";
100 | this->InputKeys[VK_VOLUME_DOWN ] = L"音量を下げる";
101 | this->InputKeys[VK_VOLUME_UP ] = L"音量を上げる";
102 | this->InputKeys[VK_MEDIA_PREV_TRACK ] = L"前のトラックへ";
103 | this->InputKeys[VK_MEDIA_NEXT_TRACK ] = L"次のトラックへ";
104 | this->InputKeys[VK_MEDIA_PLAY_PAUSE ] = L"再生/一時停止";
105 | this->InputKeys[VK_MEDIA_STOP ] = L"停止";
106 | this->InputKeys[VK_LAUNCH_MAIL ] = L"メール";
107 |
108 | // Special key code => Special action name
109 | this->Specials = gcnew Dictionary();
110 | this->Specials[FIRE_EJECT ] = L"取り出し";
111 | this->Specials[FIRE_FLIP3D ] = L"フリップ3D";
112 | this->Specials[FIRE_BRIGHT_DN] = L"暗く";
113 | this->Specials[FIRE_BRIGHT_UP] = L"明るく";
114 | this->Specials[FIRE_ALPHA_DN ] = L"透明に";
115 | this->Specials[FIRE_ALPHA_UP ] = L"不透明に";
116 | }
117 |
118 | void EditForm::LoadConfig(array^ args)
119 | {
120 | try {
121 | // decode configuration data transferred from non-elevated instance
122 | Queue^ queue = gcnew Queue(args);
123 | if (queue->Count > 0) {
124 | String^ data = queue->Dequeue();
125 | String^ cmds = String::Join(L" ", queue->ToArray());
126 | array^ buf = Convert::FromBase64String(data);
127 | if (buf->Length != Marshal::SizeOf(this->ConfigData))
128 | throw 0;
129 | IntPtr ptr = Marshal::AllocCoTaskMem(buf->Length);
130 | try {
131 | Marshal::Copy(buf, 0, ptr, buf->Length);
132 | Marshal::PtrToStructure(ptr, this->ConfigData);
133 | } finally {
134 | Marshal::FreeCoTaskMem(ptr);
135 | }
136 | for (int i = 0; i < CONFIG_NUM_CMDS; i++) {
137 | if (WORD n = this->ConfigData->cbCmds[i]) {
138 | this->ConfigCmds[i] = cmds->Substring(0, n);
139 | cmds = cmds->Remove(0, n);
140 | }
141 | }
142 | return;
143 | }
144 | } catch (...) {
145 | // failed to decode arguments
146 | }
147 | try {
148 | // load the configuration file
149 | FileStream s(this->ConfigPath, FileMode::Open, FileAccess::Read);
150 | array^ buf = gcnew array(Marshal::SizeOf(this->ConfigData));
151 | if (s.Read(buf, 0, buf->Length) != buf->Length)
152 | throw 0;
153 | IntPtr ptr = Marshal::AllocCoTaskMem(buf->Length);
154 | try {
155 | Marshal::Copy(buf, 0, ptr, buf->Length);
156 | Marshal::PtrToStructure(ptr, this->ConfigData);
157 | } finally {
158 | Marshal::FreeCoTaskMem(ptr);
159 | }
160 | #ifndef UNICODE
161 | StreamReader r(%s);
162 | #else
163 | StreamReader r(%s, System::Text::Encoding::Unicode);
164 | #endif
165 | for (int i = 0; i < CONFIG_NUM_CMDS; i++) {
166 | if (this->ConfigData->cbCmds[i] > 0) {
167 | array^ cmd = gcnew array(this->ConfigData->cbCmds[i]);
168 | r.ReadBlock(cmd, 0, cmd->Length);
169 | this->ConfigCmds[i] = gcnew String(cmd);
170 | }
171 | }
172 | } catch (...) {
173 | // if failed to load configuration data, set default settings
174 | Config_SetDefaults(this->ConfigData);
175 | }
176 | }
177 |
178 | bool EditForm::SaveConfig()
179 | {
180 | // store the length of the commands
181 | for (int i = 0; i < CONFIG_NUM_CMDS; i++) {
182 | this->ConfigData->cbCmds[i] = WORD(this->ConfigCmds[i]->Length);
183 | }
184 | try {
185 | if (!Acl::Principal::Current->HasRight(this->ConfigPath, Acl::Principal::Rights::Write)) {
186 | if (Environment::OSVersion->Version->Major < 6) {
187 | // XP or earlier: modify ACL
188 | Acl::Principal::Current->AddRight(this->ConfigPath, Acl::Principal::Rights::Write);
189 | } else {
190 | // Vista or later: start an elevated instance with current configurations
191 | array^ buf = gcnew array(Marshal::SizeOf(this->ConfigData));
192 | IntPtr ptr = Marshal::AllocCoTaskMem(Marshal::SizeOf(this->ConfigData));
193 | try {
194 | Marshal::StructureToPtr(this->ConfigData, ptr, false);
195 | Marshal::Copy(ptr, buf, 0, buf->Length);
196 | } finally {
197 | Marshal::FreeCoTaskMem(ptr);
198 | }
199 | array^ args = gcnew array{
200 | Convert::ToBase64String(buf),
201 | String::Join(L"", this->ConfigCmds)
202 | };
203 | ProcessStartInfo info;
204 | info.Verb = L"runas";
205 | info.FileName = Application::ExecutablePath;
206 | info.WorkingDirectory = AppDomain::CurrentDomain->BaseDirectory;
207 | info.Arguments = String::Join(L" ", args);
208 | Process::Start(%info);
209 | this->Close();
210 | return false;
211 | }
212 | }
213 | FileStream s(this->ConfigPath, FileMode::Create);
214 | array^ buf = gcnew array(Marshal::SizeOf(this->ConfigData));
215 | IntPtr ptr = Marshal::AllocCoTaskMem(Marshal::SizeOf(this->ConfigData));
216 | try {
217 | Marshal::StructureToPtr(this->ConfigData, ptr, false);
218 | Marshal::Copy(ptr, buf, 0, buf->Length);
219 | } finally {
220 | Marshal::FreeCoTaskMem(ptr);
221 | }
222 | s.Write(buf, 0, buf->Length);
223 | #ifndef UNICODE
224 | StreamWriter w(%s);
225 | #else
226 | StreamWriter w(%s, System::Text::Encoding::Unicode);
227 | #endif
228 | for (int i = 0; i < CONFIG_NUM_CMDS; i++) {
229 | w.Write(this->ConfigCmds[i]);
230 | }
231 | } catch (...) {
232 | return false;
233 | }
234 | return true;
235 | }
236 |
237 | void EditForm::ShowAction(WORD action)
238 | {
239 | ScopedFlag flag(this->IsSuspended);
240 |
241 | // Do Nothing
242 | this->DoNothing->Checked = (action == FIRE_NOTHING);
243 |
244 | // Input Key
245 | if (0 < action && action < 0x100) {
246 | this->InputKey->Checked = true;
247 | if (this->InputKeys->ContainsKey(action))
248 | this->InputKeyList->SelectedItem = this->InputKeys[action];
249 | else
250 | this->InputKeyList->SelectedIndex = -1;
251 | } else {
252 | this->InputKey->Checked = false;
253 | this->InputKeyList->SelectedIndex = -1;
254 | }
255 |
256 | // Special
257 | if (FIRE_CMD_0 + CONFIG_NUM_CMDS <= action && action < FIRE_NOTHING) {
258 | this->Special->Checked = true;
259 | if (this->Specials->ContainsKey(action))
260 | this->SpecialList->SelectedItem = this->Specials[action];
261 | else
262 | this->SpecialList->SelectedIndex = -1;
263 | } else {
264 | this->Special->Checked = false;
265 | this->SpecialList->SelectedIndex = -1;
266 | }
267 |
268 | // Execute
269 | if (FIRE_CMD_0 <= action && action < FIRE_CMD_0 + CONFIG_NUM_CMDS) {
270 | this->Exec->Checked = true;
271 | this->ExecCommand->Text = this->ConfigCmds[action - FIRE_CMD_0];
272 | } else {
273 | this->Exec->Checked = false;
274 | this->ExecCommand->Text = L"";
275 | }
276 | }
277 |
278 | WORD% EditForm::GetSelectedAction()
279 | {
280 | if (this->Tab->SelectedIndex == 0) {
281 | // if (this->Power->Checked ) return this->ConfigData->Key.Power;
282 | if (this->Eject->Checked ) return this->ConfigData->Key.Eject;
283 | if (this->Alnum->Checked ) return this->ConfigData->Key.Alnum;
284 | if (this->Kana->Checked ) return this->ConfigData->Key.Kana;
285 | } else {
286 | if (this->FnF1->Checked ) return this->ConfigData->Fn.F1;
287 | if (this->FnF2->Checked ) return this->ConfigData->Fn.F2;
288 | if (this->FnF3->Checked ) return this->ConfigData->Fn.F3;
289 | if (this->FnF4->Checked ) return this->ConfigData->Fn.F4;
290 | if (this->FnF5->Checked ) return this->ConfigData->Fn.F5;
291 | if (this->FnF6->Checked ) return this->ConfigData->Fn.F6;
292 | if (this->FnF7->Checked ) return this->ConfigData->Fn.F7;
293 | if (this->FnF8->Checked ) return this->ConfigData->Fn.F8;
294 | if (this->FnF9->Checked ) return this->ConfigData->Fn.F9;
295 | if (this->FnF10->Checked ) return this->ConfigData->Fn.F10;
296 | if (this->FnF11->Checked ) return this->ConfigData->Fn.F11;
297 | if (this->FnF12->Checked ) return this->ConfigData->Fn.F12;
298 | if (this->FnDel->Checked ) return this->ConfigData->Fn.Del;
299 | if (this->FnUp->Checked ) return this->ConfigData->Fn.Up;
300 | if (this->FnDown->Checked ) return this->ConfigData->Fn.Down;
301 | if (this->FnLeft->Checked ) return this->ConfigData->Fn.Left;
302 | if (this->FnRight->Checked) return this->ConfigData->Fn.Right;
303 | if (this->FnEject->Checked) return this->ConfigData->Fn.Eject;
304 | }
305 | static WORD dummy;
306 | return dummy = 0;
307 | }
308 |
309 | void EditForm::ResetActionsExceptFor(System::Windows::Forms::Control^ control)
310 | {
311 | ScopedFlag flag(this->IsSuspended);
312 |
313 | if (control != this->InputKeyList)
314 | this->InputKeyList->SelectedIndex = -1;
315 | if (control != this->SpecialList)
316 | this->SpecialList->SelectedIndex = -1;
317 | if (control != this->ExecCommand) {
318 | this->ExecCommand->Text = L"";
319 | WORD% action = this->GetSelectedAction();
320 | if (FIRE_CMD_0 <= action && action < FIRE_CMD_0 + CONFIG_NUM_CMDS)
321 | this->ConfigCmds[action - FIRE_CMD_0] = L"";
322 | }
323 | }
324 |
325 | System::Void EditForm::EditForm_Load(System::Object^ /*sender*/, System::EventArgs^ /*e*/)
326 | {
327 | for each (KeyValuePair^ it in this->InputKeys)
328 | this->InputKeyList->Items->Add(it->Value);
329 | for each (KeyValuePair^ it in this->Specials)
330 | this->SpecialList->Items->Add(it->Value);
331 | if (!Acl::Principal::Current->HasRight(this->ConfigPath, Acl::Principal::Rights::Write)) {
332 | if (Environment::OSVersion->Version->Major >= 6) {
333 | // show the UAC shield icon in the OK button
334 | this->Apply->FlatStyle = FlatStyle::System;
335 | HandleRef hButton(this->Apply, this->Apply->Handle);
336 | ::SendMessage(hButton.Handle, BCM_SETSHIELD, WPARAM::Zero, LPARAM(TRUE));
337 | }
338 | }
339 | }
340 |
341 | System::Void EditForm::Cancel_Click(System::Object^ /*sender*/, System::EventArgs^ /*e*/)
342 | {
343 | this->Close();
344 | }
345 |
346 | System::Void EditForm::Apply_Click(System::Object^ /*sender*/, System::EventArgs^ /*e*/)
347 | {
348 | if (SaveConfig()) {
349 | // notify the main application to reload configurations
350 | HWND hWnd = ::FindWindow(App::Class, App::Title);
351 | if (hWnd != HWND::Zero) {
352 | ::PostMessage(hWnd, WM_APP_RELOAD, WPARAM::Zero, LPARAM::Zero);
353 | }
354 | }
355 | this->Close();
356 | }
357 |
358 | System::Void EditForm::ExecFind_Click(System::Object^ /*sender*/, System::EventArgs^ /*e*/)
359 | {
360 | if (File::Exists(this->ExecCommand->Text))
361 | this->FileDlg->FileName = this->ExecCommand->Text;
362 | else if (Directory::Exists(this->ExecCommand->Text))
363 | this->FileDlg->InitialDirectory = this->ExecCommand->Text;
364 | if (this->FileDlg->ShowDialog() == System::Windows::Forms::DialogResult::OK) {
365 | this->ExecCommand->Text = this->FileDlg->FileName;
366 | }
367 | }
368 |
369 | System::Void EditForm::SelectedChanged(System::Object^ /*sender*/, System::EventArgs^ /*e*/)
370 | {
371 | ShowAction(GetSelectedAction());
372 | }
373 |
374 | System::Void EditForm::DoNothing_CheckedChanged(System::Object^ /*sender*/, System::EventArgs^ /*e*/)
375 | {
376 | if (this->IsSuspended)
377 | return;
378 |
379 | if (this->DoNothing->Checked) {
380 | ResetActionsExceptFor(nullptr);
381 | GetSelectedAction() = FIRE_NOTHING;
382 | }
383 | }
384 |
385 | System::Void EditForm::InputKeyList_SelectedIndexChanged(System::Object^ /*sender*/, System::EventArgs^ /*e*/)
386 | {
387 | if (this->IsSuspended)
388 | return;
389 |
390 | for each (KeyValuePair^ it in this->InputKeys) {
391 | if (this->InputKeyList->Text == it->Value) {
392 | this->InputKey->Checked = true;
393 | ResetActionsExceptFor(this->InputKeyList);
394 | GetSelectedAction() = it->Key;
395 | break;
396 | }
397 | }
398 | }
399 |
400 | System::Void EditForm::SpecialList_SelectedIndexChanged(System::Object^ /*sender*/, System::EventArgs^ /*e*/)
401 | {
402 | if (this->IsSuspended)
403 | return;
404 |
405 | for each (KeyValuePair^ it in this->Specials) {
406 | if (this->SpecialList->Text == it->Value) {
407 | this->Special->Checked = true;
408 | ResetActionsExceptFor(this->SpecialList);
409 | GetSelectedAction() = it->Key;
410 | break;
411 | }
412 | }
413 | }
414 |
415 | System::Void EditForm::ExecCommand_TextChanged(System::Object^ /*sender*/, System::EventArgs^ /*e*/)
416 | {
417 | if (this->IsSuspended)
418 | return;
419 |
420 | WORD% action = GetSelectedAction();
421 | if (action == 0)
422 | return;
423 | int index = -1;
424 | if (FIRE_CMD_0 <= action && action < FIRE_CMD_0 + CONFIG_NUM_CMDS)
425 | index = action - FIRE_CMD_0;
426 | else for (int i = 0; i < CONFIG_NUM_CMDS; i++) {
427 | if (this->ConfigCmds[i]->Length == 0) {
428 | index = i;
429 | break;
430 | }
431 | }
432 | if (index >= 0 && this->ExecCommand->Text->Length > 0) {
433 | this->ConfigCmds[index] = this->ExecCommand->Text;
434 | this->Exec->Checked = true;
435 | ResetActionsExceptFor(this->ExecCommand);
436 | action = WORD(FIRE_CMD_0 + index);
437 | } else if (this->Exec->Checked) {
438 | this->DoNothing->Checked = true;
439 | ResetActionsExceptFor(nullptr);
440 | action = FIRE_NOTHING;
441 | } else {
442 | this->ExecCommand->Text = L"";
443 | }
444 | }
445 | }
446 |
--------------------------------------------------------------------------------
/akbcf/EditForm.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Apple Keyboard Bridge https://github.com/andantissimo/Apple-Keyboard-Bridge
3 | */
4 | #pragma once
5 |
6 | #include "../common/akb.h"
7 |
8 | namespace akbcf
9 | {
10 | ///
11 | /// Apple Keyboard Bridge - Configuration Editor
12 | ///
13 | public ref class EditForm : public System::Windows::Forms::Form
14 | {
15 | public:
16 | EditForm(array^ args)
17 | {
18 | InitializeComponent();
19 |
20 | LoadResources();
21 | this->ConfigPath = System::IO::Path::Combine(System::AppDomain::CurrentDomain->BaseDirectory, L"akb.cf");
22 | this->ConfigData = gcnew Config();
23 | this->ConfigCmds = gcnew array(CONFIG_NUM_CMDS);
24 | for (int i = 0; i < this->ConfigCmds->Length; i++)
25 | this->ConfigCmds[i] = L"";
26 | LoadConfig(args);
27 | }
28 |
29 | protected:
30 | ~EditForm()
31 | {
32 | if (components)
33 | {
34 | delete components;
35 | }
36 | }
37 |
38 | private:
39 | System::Windows::Forms::TabControl^ Tab;
40 | System::Windows::Forms::TabPage^ Singles;
41 | System::Windows::Forms::TabPage^ Combinations;
42 |
43 | System::Windows::Forms::RadioButton^ F1;
44 | System::Windows::Forms::RadioButton^ F2;
45 | System::Windows::Forms::RadioButton^ F3;
46 | System::Windows::Forms::RadioButton^ F4;
47 | System::Windows::Forms::RadioButton^ F5;
48 | System::Windows::Forms::RadioButton^ F6;
49 | System::Windows::Forms::RadioButton^ F7;
50 | System::Windows::Forms::RadioButton^ F8;
51 | System::Windows::Forms::RadioButton^ F9;
52 | System::Windows::Forms::RadioButton^ F10;
53 | System::Windows::Forms::RadioButton^ F11;
54 | System::Windows::Forms::RadioButton^ F12;
55 | System::Windows::Forms::RadioButton^ Eject;
56 | System::Windows::Forms::RadioButton^ Del;
57 | System::Windows::Forms::RadioButton^ Alnum;
58 | System::Windows::Forms::RadioButton^ Space;
59 | System::Windows::Forms::RadioButton^ Kana;
60 | System::Windows::Forms::RadioButton^ Up;
61 | System::Windows::Forms::RadioButton^ Left;
62 | System::Windows::Forms::RadioButton^ Down;
63 | System::Windows::Forms::RadioButton^ Right;
64 |
65 | System::Windows::Forms::RadioButton^ FnF1;
66 | System::Windows::Forms::RadioButton^ FnF2;
67 | System::Windows::Forms::RadioButton^ FnF3;
68 | System::Windows::Forms::RadioButton^ FnF4;
69 | System::Windows::Forms::RadioButton^ FnF6;
70 | System::Windows::Forms::RadioButton^ FnF7;
71 | System::Windows::Forms::RadioButton^ FnF8;
72 | System::Windows::Forms::RadioButton^ FnF5;
73 | System::Windows::Forms::RadioButton^ FnF9;
74 | System::Windows::Forms::RadioButton^ FnF10;
75 | System::Windows::Forms::RadioButton^ FnF11;
76 | System::Windows::Forms::RadioButton^ FnF12;
77 | System::Windows::Forms::RadioButton^ FnEject;
78 | System::Windows::Forms::RadioButton^ FnDel;
79 | System::Windows::Forms::RadioButton^ FnAlnum;
80 | System::Windows::Forms::RadioButton^ FnSpace;
81 | System::Windows::Forms::RadioButton^ FnKana;
82 | System::Windows::Forms::RadioButton^ FnUp;
83 | System::Windows::Forms::RadioButton^ FnLeft;
84 | System::Windows::Forms::RadioButton^ FnDown;
85 | System::Windows::Forms::RadioButton^ FnRight;
86 |
87 | System::Windows::Forms::GroupBox^ Action;
88 | System::Windows::Forms::RadioButton^ DoNothing;
89 | System::Windows::Forms::RadioButton^ InputKey;
90 | System::Windows::Forms::ComboBox^ InputKeyList;
91 | System::Windows::Forms::RadioButton^ Special;
92 | System::Windows::Forms::ComboBox^ SpecialList;
93 | System::Windows::Forms::RadioButton^ Exec;
94 | System::Windows::Forms::TextBox^ ExecCommand;
95 | System::Windows::Forms::Button^ ExecFind;
96 |
97 | System::Windows::Forms::Button^ Cancel;
98 | System::Windows::Forms::Button^ Apply;
99 |
100 | System::Windows::Forms::OpenFileDialog^ FileDlg;
101 |
102 | private:
103 | ///
104 | /// 必要なデザイナ変数です。
105 | ///
106 | System::ComponentModel::Container ^components;
107 |
108 | #pragma region Windows Form Designer generated code
109 | ///
110 | /// デザイナ サポートに必要なメソッドです。このメソッドの内容を
111 | /// コード エディタで変更しないでください。
112 | ///
113 | void InitializeComponent(void)
114 | {
115 | this->Tab = (gcnew System::Windows::Forms::TabControl());
116 | this->Singles = (gcnew System::Windows::Forms::TabPage());
117 | this->F1 = (gcnew System::Windows::Forms::RadioButton());
118 | this->F2 = (gcnew System::Windows::Forms::RadioButton());
119 | this->F3 = (gcnew System::Windows::Forms::RadioButton());
120 | this->F4 = (gcnew System::Windows::Forms::RadioButton());
121 | this->F5 = (gcnew System::Windows::Forms::RadioButton());
122 | this->F6 = (gcnew System::Windows::Forms::RadioButton());
123 | this->F7 = (gcnew System::Windows::Forms::RadioButton());
124 | this->F8 = (gcnew System::Windows::Forms::RadioButton());
125 | this->F9 = (gcnew System::Windows::Forms::RadioButton());
126 | this->F10 = (gcnew System::Windows::Forms::RadioButton());
127 | this->F11 = (gcnew System::Windows::Forms::RadioButton());
128 | this->F12 = (gcnew System::Windows::Forms::RadioButton());
129 | this->Eject = (gcnew System::Windows::Forms::RadioButton());
130 | this->Del = (gcnew System::Windows::Forms::RadioButton());
131 | this->Alnum = (gcnew System::Windows::Forms::RadioButton());
132 | this->Space = (gcnew System::Windows::Forms::RadioButton());
133 | this->Kana = (gcnew System::Windows::Forms::RadioButton());
134 | this->Up = (gcnew System::Windows::Forms::RadioButton());
135 | this->Left = (gcnew System::Windows::Forms::RadioButton());
136 | this->Down = (gcnew System::Windows::Forms::RadioButton());
137 | this->Right = (gcnew System::Windows::Forms::RadioButton());
138 | this->Combinations = (gcnew System::Windows::Forms::TabPage());
139 | this->FnF1 = (gcnew System::Windows::Forms::RadioButton());
140 | this->FnF2 = (gcnew System::Windows::Forms::RadioButton());
141 | this->FnF3 = (gcnew System::Windows::Forms::RadioButton());
142 | this->FnF4 = (gcnew System::Windows::Forms::RadioButton());
143 | this->FnF5 = (gcnew System::Windows::Forms::RadioButton());
144 | this->FnF6 = (gcnew System::Windows::Forms::RadioButton());
145 | this->FnF7 = (gcnew System::Windows::Forms::RadioButton());
146 | this->FnF8 = (gcnew System::Windows::Forms::RadioButton());
147 | this->FnF9 = (gcnew System::Windows::Forms::RadioButton());
148 | this->FnF10 = (gcnew System::Windows::Forms::RadioButton());
149 | this->FnF11 = (gcnew System::Windows::Forms::RadioButton());
150 | this->FnF12 = (gcnew System::Windows::Forms::RadioButton());
151 | this->FnEject = (gcnew System::Windows::Forms::RadioButton());
152 | this->FnDel = (gcnew System::Windows::Forms::RadioButton());
153 | this->FnAlnum = (gcnew System::Windows::Forms::RadioButton());
154 | this->FnSpace = (gcnew System::Windows::Forms::RadioButton());
155 | this->FnKana = (gcnew System::Windows::Forms::RadioButton());
156 | this->FnUp = (gcnew System::Windows::Forms::RadioButton());
157 | this->FnLeft = (gcnew System::Windows::Forms::RadioButton());
158 | this->FnDown = (gcnew System::Windows::Forms::RadioButton());
159 | this->FnRight = (gcnew System::Windows::Forms::RadioButton());
160 | this->Action = (gcnew System::Windows::Forms::GroupBox());
161 | this->DoNothing = (gcnew System::Windows::Forms::RadioButton());
162 | this->InputKey = (gcnew System::Windows::Forms::RadioButton());
163 | this->InputKeyList = (gcnew System::Windows::Forms::ComboBox());
164 | this->Special = (gcnew System::Windows::Forms::RadioButton());
165 | this->SpecialList = (gcnew System::Windows::Forms::ComboBox());
166 | this->Exec = (gcnew System::Windows::Forms::RadioButton());
167 | this->ExecCommand = (gcnew System::Windows::Forms::TextBox());
168 | this->ExecFind = (gcnew System::Windows::Forms::Button());
169 | this->Cancel = (gcnew System::Windows::Forms::Button());
170 | this->Apply = (gcnew System::Windows::Forms::Button());
171 | this->FileDlg = (gcnew System::Windows::Forms::OpenFileDialog());
172 | this->Tab->SuspendLayout();
173 | this->Singles->SuspendLayout();
174 | this->Combinations->SuspendLayout();
175 | this->Action->SuspendLayout();
176 | this->SuspendLayout();
177 | //
178 | // Tab
179 | //
180 | this->Tab->Appearance = System::Windows::Forms::TabAppearance::FlatButtons;
181 | this->Tab->Controls->Add(this->Singles);
182 | this->Tab->Controls->Add(this->Combinations);
183 | this->Tab->Dock = System::Windows::Forms::DockStyle::Top;
184 | this->Tab->Location = System::Drawing::Point(0, 0);
185 | this->Tab->Margin = System::Windows::Forms::Padding(0);
186 | this->Tab->Name = L"Tab";
187 | this->Tab->SelectedIndex = 0;
188 | this->Tab->Size = System::Drawing::Size(654, 145);
189 | this->Tab->TabIndex = 0;
190 | this->Tab->SelectedIndexChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
191 | //
192 | // Singles
193 | //
194 | this->Singles->Controls->Add(this->F1);
195 | this->Singles->Controls->Add(this->F2);
196 | this->Singles->Controls->Add(this->F3);
197 | this->Singles->Controls->Add(this->F4);
198 | this->Singles->Controls->Add(this->F5);
199 | this->Singles->Controls->Add(this->F6);
200 | this->Singles->Controls->Add(this->F7);
201 | this->Singles->Controls->Add(this->F8);
202 | this->Singles->Controls->Add(this->F9);
203 | this->Singles->Controls->Add(this->F10);
204 | this->Singles->Controls->Add(this->F11);
205 | this->Singles->Controls->Add(this->F12);
206 | this->Singles->Controls->Add(this->Eject);
207 | this->Singles->Controls->Add(this->Del);
208 | this->Singles->Controls->Add(this->Alnum);
209 | this->Singles->Controls->Add(this->Space);
210 | this->Singles->Controls->Add(this->Kana);
211 | this->Singles->Controls->Add(this->Up);
212 | this->Singles->Controls->Add(this->Left);
213 | this->Singles->Controls->Add(this->Down);
214 | this->Singles->Controls->Add(this->Right);
215 | this->Singles->Location = System::Drawing::Point(4, 24);
216 | this->Singles->Margin = System::Windows::Forms::Padding(0);
217 | this->Singles->Name = L"Singles";
218 | this->Singles->Padding = System::Windows::Forms::Padding(3);
219 | this->Singles->Size = System::Drawing::Size(646, 117);
220 | this->Singles->TabIndex = 0;
221 | this->Singles->Text = L"単独";
222 | this->Singles->UseVisualStyleBackColor = true;
223 | //
224 | // F1
225 | //
226 | this->F1->Appearance = System::Windows::Forms::Appearance::Button;
227 | this->F1->Enabled = false;
228 | this->F1->Location = System::Drawing::Point(0, 0);
229 | this->F1->Margin = System::Windows::Forms::Padding(0);
230 | this->F1->Name = L"F1";
231 | this->F1->Size = System::Drawing::Size(45, 25);
232 | this->F1->TabIndex = 1;
233 | this->F1->Text = L"F1";
234 | this->F1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
235 | this->F1->UseVisualStyleBackColor = true;
236 | this->F1->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
237 | //
238 | // F2
239 | //
240 | this->F2->Appearance = System::Windows::Forms::Appearance::Button;
241 | this->F2->Enabled = false;
242 | this->F2->Location = System::Drawing::Point(50, 0);
243 | this->F2->Margin = System::Windows::Forms::Padding(0);
244 | this->F2->Name = L"F2";
245 | this->F2->Size = System::Drawing::Size(45, 25);
246 | this->F2->TabIndex = 2;
247 | this->F2->Text = L"F2";
248 | this->F2->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
249 | this->F2->UseVisualStyleBackColor = true;
250 | this->F2->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
251 | //
252 | // F3
253 | //
254 | this->F3->Appearance = System::Windows::Forms::Appearance::Button;
255 | this->F3->Enabled = false;
256 | this->F3->Location = System::Drawing::Point(100, 0);
257 | this->F3->Margin = System::Windows::Forms::Padding(0);
258 | this->F3->Name = L"F3";
259 | this->F3->Size = System::Drawing::Size(45, 25);
260 | this->F3->TabIndex = 3;
261 | this->F3->Text = L"F3";
262 | this->F3->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
263 | this->F3->UseVisualStyleBackColor = true;
264 | this->F3->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
265 | //
266 | // F4
267 | //
268 | this->F4->Appearance = System::Windows::Forms::Appearance::Button;
269 | this->F4->Enabled = false;
270 | this->F4->Location = System::Drawing::Point(150, 0);
271 | this->F4->Margin = System::Windows::Forms::Padding(0);
272 | this->F4->Name = L"F4";
273 | this->F4->Size = System::Drawing::Size(45, 25);
274 | this->F4->TabIndex = 4;
275 | this->F4->Text = L"F4";
276 | this->F4->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
277 | this->F4->UseVisualStyleBackColor = true;
278 | this->F4->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
279 | //
280 | // F5
281 | //
282 | this->F5->Appearance = System::Windows::Forms::Appearance::Button;
283 | this->F5->Enabled = false;
284 | this->F5->Location = System::Drawing::Point(200, 0);
285 | this->F5->Margin = System::Windows::Forms::Padding(0);
286 | this->F5->Name = L"F5";
287 | this->F5->Size = System::Drawing::Size(45, 25);
288 | this->F5->TabIndex = 5;
289 | this->F5->Text = L"F5";
290 | this->F5->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
291 | this->F5->UseVisualStyleBackColor = true;
292 | this->F5->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
293 | //
294 | // F6
295 | //
296 | this->F6->Appearance = System::Windows::Forms::Appearance::Button;
297 | this->F6->Enabled = false;
298 | this->F6->Location = System::Drawing::Point(250, 0);
299 | this->F6->Margin = System::Windows::Forms::Padding(0);
300 | this->F6->Name = L"F6";
301 | this->F6->Size = System::Drawing::Size(45, 25);
302 | this->F6->TabIndex = 6;
303 | this->F6->Text = L"F6";
304 | this->F6->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
305 | this->F6->UseVisualStyleBackColor = true;
306 | this->F6->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
307 | //
308 | // F7
309 | //
310 | this->F7->Appearance = System::Windows::Forms::Appearance::Button;
311 | this->F7->Enabled = false;
312 | this->F7->Location = System::Drawing::Point(300, 0);
313 | this->F7->Margin = System::Windows::Forms::Padding(0);
314 | this->F7->Name = L"F7";
315 | this->F7->Size = System::Drawing::Size(45, 25);
316 | this->F7->TabIndex = 7;
317 | this->F7->Text = L"F7";
318 | this->F7->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
319 | this->F7->UseVisualStyleBackColor = true;
320 | this->F7->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
321 | //
322 | // F8
323 | //
324 | this->F8->Appearance = System::Windows::Forms::Appearance::Button;
325 | this->F8->Enabled = false;
326 | this->F8->Location = System::Drawing::Point(350, 0);
327 | this->F8->Margin = System::Windows::Forms::Padding(0);
328 | this->F8->Name = L"F8";
329 | this->F8->Size = System::Drawing::Size(45, 25);
330 | this->F8->TabIndex = 8;
331 | this->F8->Text = L"F8";
332 | this->F8->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
333 | this->F8->UseVisualStyleBackColor = true;
334 | this->F8->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
335 | //
336 | // F9
337 | //
338 | this->F9->Appearance = System::Windows::Forms::Appearance::Button;
339 | this->F9->Enabled = false;
340 | this->F9->Location = System::Drawing::Point(400, 0);
341 | this->F9->Margin = System::Windows::Forms::Padding(0);
342 | this->F9->Name = L"F9";
343 | this->F9->Size = System::Drawing::Size(45, 25);
344 | this->F9->TabIndex = 9;
345 | this->F9->Text = L"F9";
346 | this->F9->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
347 | this->F9->UseVisualStyleBackColor = true;
348 | this->F9->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
349 | //
350 | // F10
351 | //
352 | this->F10->Appearance = System::Windows::Forms::Appearance::Button;
353 | this->F10->Enabled = false;
354 | this->F10->Location = System::Drawing::Point(450, 0);
355 | this->F10->Margin = System::Windows::Forms::Padding(0);
356 | this->F10->Name = L"F10";
357 | this->F10->Size = System::Drawing::Size(45, 25);
358 | this->F10->TabIndex = 10;
359 | this->F10->Text = L"F10";
360 | this->F10->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
361 | this->F10->UseVisualStyleBackColor = true;
362 | this->F10->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
363 | //
364 | // F11
365 | //
366 | this->F11->Appearance = System::Windows::Forms::Appearance::Button;
367 | this->F11->Enabled = false;
368 | this->F11->Location = System::Drawing::Point(500, 0);
369 | this->F11->Margin = System::Windows::Forms::Padding(0);
370 | this->F11->Name = L"F11";
371 | this->F11->Size = System::Drawing::Size(45, 25);
372 | this->F11->TabIndex = 11;
373 | this->F11->Text = L"F11";
374 | this->F11->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
375 | this->F11->UseVisualStyleBackColor = true;
376 | this->F11->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
377 | //
378 | // F12
379 | //
380 | this->F12->Appearance = System::Windows::Forms::Appearance::Button;
381 | this->F12->Enabled = false;
382 | this->F12->Location = System::Drawing::Point(550, 0);
383 | this->F12->Margin = System::Windows::Forms::Padding(0);
384 | this->F12->Name = L"F12";
385 | this->F12->Size = System::Drawing::Size(45, 25);
386 | this->F12->TabIndex = 12;
387 | this->F12->Text = L"F12";
388 | this->F12->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
389 | this->F12->UseVisualStyleBackColor = true;
390 | this->F12->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
391 | //
392 | // Eject
393 | //
394 | this->Eject->Appearance = System::Windows::Forms::Appearance::Button;
395 | this->Eject->Location = System::Drawing::Point(600, 0);
396 | this->Eject->Margin = System::Windows::Forms::Padding(0);
397 | this->Eject->Name = L"Eject";
398 | this->Eject->Size = System::Drawing::Size(45, 25);
399 | this->Eject->TabIndex = 13;
400 | this->Eject->Text = L"▲";
401 | this->Eject->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
402 | this->Eject->UseVisualStyleBackColor = true;
403 | this->Eject->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
404 | //
405 | // Del
406 | //
407 | this->Del->Appearance = System::Windows::Forms::Appearance::Button;
408 | this->Del->Enabled = false;
409 | this->Del->Location = System::Drawing::Point(600, 30);
410 | this->Del->Margin = System::Windows::Forms::Padding(0);
411 | this->Del->Name = L"Del";
412 | this->Del->Size = System::Drawing::Size(45, 25);
413 | this->Del->TabIndex = 14;
414 | this->Del->Text = L"delete";
415 | this->Del->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
416 | this->Del->UseVisualStyleBackColor = true;
417 | this->Del->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
418 | //
419 | // Alnum
420 | //
421 | this->Alnum->Appearance = System::Windows::Forms::Appearance::Button;
422 | this->Alnum->Location = System::Drawing::Point(150, 90);
423 | this->Alnum->Margin = System::Windows::Forms::Padding(0);
424 | this->Alnum->Name = L"Alnum";
425 | this->Alnum->Size = System::Drawing::Size(45, 25);
426 | this->Alnum->TabIndex = 15;
427 | this->Alnum->Text = L"英数";
428 | this->Alnum->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
429 | this->Alnum->UseVisualStyleBackColor = true;
430 | this->Alnum->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
431 | //
432 | // Space
433 | //
434 | this->Space->Appearance = System::Windows::Forms::Appearance::Button;
435 | this->Space->Enabled = false;
436 | this->Space->Location = System::Drawing::Point(200, 90);
437 | this->Space->Margin = System::Windows::Forms::Padding(0);
438 | this->Space->Name = L"Space";
439 | this->Space->Size = System::Drawing::Size(145, 25);
440 | this->Space->TabIndex = 16;
441 | this->Space->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
442 | this->Space->UseVisualStyleBackColor = true;
443 | this->Space->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
444 | //
445 | // Kana
446 | //
447 | this->Kana->Appearance = System::Windows::Forms::Appearance::Button;
448 | this->Kana->Location = System::Drawing::Point(350, 90);
449 | this->Kana->Margin = System::Windows::Forms::Padding(0);
450 | this->Kana->Name = L"Kana";
451 | this->Kana->Size = System::Drawing::Size(45, 25);
452 | this->Kana->TabIndex = 17;
453 | this->Kana->Text = L"かな";
454 | this->Kana->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
455 | this->Kana->UseVisualStyleBackColor = true;
456 | this->Kana->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
457 | //
458 | // Up
459 | //
460 | this->Up->Appearance = System::Windows::Forms::Appearance::Button;
461 | this->Up->Enabled = false;
462 | this->Up->Location = System::Drawing::Point(550, 60);
463 | this->Up->Margin = System::Windows::Forms::Padding(0);
464 | this->Up->Name = L"Up";
465 | this->Up->Size = System::Drawing::Size(45, 25);
466 | this->Up->TabIndex = 18;
467 | this->Up->Text = L"↑";
468 | this->Up->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
469 | this->Up->UseVisualStyleBackColor = true;
470 | this->Up->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
471 | //
472 | // Left
473 | //
474 | this->Left->Appearance = System::Windows::Forms::Appearance::Button;
475 | this->Left->Enabled = false;
476 | this->Left->Location = System::Drawing::Point(500, 90);
477 | this->Left->Margin = System::Windows::Forms::Padding(0);
478 | this->Left->Name = L"Left";
479 | this->Left->Size = System::Drawing::Size(45, 25);
480 | this->Left->TabIndex = 19;
481 | this->Left->Text = L"←";
482 | this->Left->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
483 | this->Left->UseVisualStyleBackColor = true;
484 | this->Left->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
485 | //
486 | // Down
487 | //
488 | this->Down->Appearance = System::Windows::Forms::Appearance::Button;
489 | this->Down->Enabled = false;
490 | this->Down->Location = System::Drawing::Point(550, 90);
491 | this->Down->Margin = System::Windows::Forms::Padding(0);
492 | this->Down->Name = L"Down";
493 | this->Down->Size = System::Drawing::Size(45, 25);
494 | this->Down->TabIndex = 20;
495 | this->Down->Text = L"↓";
496 | this->Down->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
497 | this->Down->UseVisualStyleBackColor = true;
498 | this->Down->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
499 | //
500 | // Right
501 | //
502 | this->Right->Appearance = System::Windows::Forms::Appearance::Button;
503 | this->Right->Enabled = false;
504 | this->Right->Location = System::Drawing::Point(600, 90);
505 | this->Right->Margin = System::Windows::Forms::Padding(0);
506 | this->Right->Name = L"Right";
507 | this->Right->Size = System::Drawing::Size(45, 25);
508 | this->Right->TabIndex = 21;
509 | this->Right->Text = L"→";
510 | this->Right->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
511 | this->Right->UseVisualStyleBackColor = true;
512 | this->Right->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
513 | //
514 | // Combinations
515 | //
516 | this->Combinations->Controls->Add(this->FnF1);
517 | this->Combinations->Controls->Add(this->FnF2);
518 | this->Combinations->Controls->Add(this->FnF3);
519 | this->Combinations->Controls->Add(this->FnF4);
520 | this->Combinations->Controls->Add(this->FnF5);
521 | this->Combinations->Controls->Add(this->FnF6);
522 | this->Combinations->Controls->Add(this->FnF7);
523 | this->Combinations->Controls->Add(this->FnF8);
524 | this->Combinations->Controls->Add(this->FnF9);
525 | this->Combinations->Controls->Add(this->FnF10);
526 | this->Combinations->Controls->Add(this->FnF11);
527 | this->Combinations->Controls->Add(this->FnF12);
528 | this->Combinations->Controls->Add(this->FnEject);
529 | this->Combinations->Controls->Add(this->FnDel);
530 | this->Combinations->Controls->Add(this->FnAlnum);
531 | this->Combinations->Controls->Add(this->FnSpace);
532 | this->Combinations->Controls->Add(this->FnKana);
533 | this->Combinations->Controls->Add(this->FnUp);
534 | this->Combinations->Controls->Add(this->FnLeft);
535 | this->Combinations->Controls->Add(this->FnDown);
536 | this->Combinations->Controls->Add(this->FnRight);
537 | this->Combinations->Location = System::Drawing::Point(4, 24);
538 | this->Combinations->Name = L"Combinations";
539 | this->Combinations->Padding = System::Windows::Forms::Padding(3);
540 | this->Combinations->Size = System::Drawing::Size(646, 117);
541 | this->Combinations->TabIndex = 1;
542 | this->Combinations->Text = L"Fn +";
543 | this->Combinations->UseVisualStyleBackColor = true;
544 | //
545 | // FnF1
546 | //
547 | this->FnF1->Appearance = System::Windows::Forms::Appearance::Button;
548 | this->FnF1->Location = System::Drawing::Point(0, 0);
549 | this->FnF1->Margin = System::Windows::Forms::Padding(0);
550 | this->FnF1->Name = L"FnF1";
551 | this->FnF1->Size = System::Drawing::Size(45, 25);
552 | this->FnF1->TabIndex = 1;
553 | this->FnF1->Text = L"F1";
554 | this->FnF1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
555 | this->FnF1->UseVisualStyleBackColor = true;
556 | this->FnF1->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
557 | //
558 | // FnF2
559 | //
560 | this->FnF2->Appearance = System::Windows::Forms::Appearance::Button;
561 | this->FnF2->Location = System::Drawing::Point(50, 0);
562 | this->FnF2->Margin = System::Windows::Forms::Padding(0);
563 | this->FnF2->Name = L"FnF2";
564 | this->FnF2->Size = System::Drawing::Size(45, 25);
565 | this->FnF2->TabIndex = 2;
566 | this->FnF2->Text = L"F2";
567 | this->FnF2->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
568 | this->FnF2->UseVisualStyleBackColor = true;
569 | this->FnF2->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
570 | //
571 | // FnF3
572 | //
573 | this->FnF3->Appearance = System::Windows::Forms::Appearance::Button;
574 | this->FnF3->Location = System::Drawing::Point(100, 0);
575 | this->FnF3->Margin = System::Windows::Forms::Padding(0);
576 | this->FnF3->Name = L"FnF3";
577 | this->FnF3->Size = System::Drawing::Size(45, 25);
578 | this->FnF3->TabIndex = 3;
579 | this->FnF3->Text = L"F3";
580 | this->FnF3->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
581 | this->FnF3->UseVisualStyleBackColor = true;
582 | this->FnF3->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
583 | //
584 | // FnF4
585 | //
586 | this->FnF4->Appearance = System::Windows::Forms::Appearance::Button;
587 | this->FnF4->Location = System::Drawing::Point(150, 0);
588 | this->FnF4->Margin = System::Windows::Forms::Padding(0);
589 | this->FnF4->Name = L"FnF4";
590 | this->FnF4->Size = System::Drawing::Size(45, 25);
591 | this->FnF4->TabIndex = 4;
592 | this->FnF4->Text = L"F4";
593 | this->FnF4->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
594 | this->FnF4->UseVisualStyleBackColor = true;
595 | this->FnF4->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
596 | //
597 | // FnF5
598 | //
599 | this->FnF5->Appearance = System::Windows::Forms::Appearance::Button;
600 | this->FnF5->Location = System::Drawing::Point(200, 0);
601 | this->FnF5->Margin = System::Windows::Forms::Padding(0);
602 | this->FnF5->Name = L"FnF5";
603 | this->FnF5->Size = System::Drawing::Size(45, 25);
604 | this->FnF5->TabIndex = 5;
605 | this->FnF5->Text = L"F5";
606 | this->FnF5->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
607 | this->FnF5->UseVisualStyleBackColor = true;
608 | this->FnF5->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
609 | //
610 | // FnF6
611 | //
612 | this->FnF6->Appearance = System::Windows::Forms::Appearance::Button;
613 | this->FnF6->Location = System::Drawing::Point(250, 0);
614 | this->FnF6->Margin = System::Windows::Forms::Padding(0);
615 | this->FnF6->Name = L"FnF6";
616 | this->FnF6->Size = System::Drawing::Size(45, 25);
617 | this->FnF6->TabIndex = 6;
618 | this->FnF6->Text = L"F6";
619 | this->FnF6->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
620 | this->FnF6->UseVisualStyleBackColor = true;
621 | this->FnF6->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
622 | //
623 | // FnF7
624 | //
625 | this->FnF7->Appearance = System::Windows::Forms::Appearance::Button;
626 | this->FnF7->Location = System::Drawing::Point(300, 0);
627 | this->FnF7->Margin = System::Windows::Forms::Padding(0);
628 | this->FnF7->Name = L"FnF7";
629 | this->FnF7->Size = System::Drawing::Size(45, 25);
630 | this->FnF7->TabIndex = 7;
631 | this->FnF7->Text = L"F7";
632 | this->FnF7->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
633 | this->FnF7->UseVisualStyleBackColor = true;
634 | this->FnF7->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
635 | //
636 | // FnF8
637 | //
638 | this->FnF8->Appearance = System::Windows::Forms::Appearance::Button;
639 | this->FnF8->Location = System::Drawing::Point(350, 0);
640 | this->FnF8->Margin = System::Windows::Forms::Padding(0);
641 | this->FnF8->Name = L"FnF8";
642 | this->FnF8->Size = System::Drawing::Size(45, 25);
643 | this->FnF8->TabIndex = 8;
644 | this->FnF8->Text = L"F8";
645 | this->FnF8->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
646 | this->FnF8->UseVisualStyleBackColor = true;
647 | this->FnF8->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
648 | //
649 | // FnF9
650 | //
651 | this->FnF9->Appearance = System::Windows::Forms::Appearance::Button;
652 | this->FnF9->Location = System::Drawing::Point(400, 0);
653 | this->FnF9->Margin = System::Windows::Forms::Padding(0);
654 | this->FnF9->Name = L"FnF9";
655 | this->FnF9->Size = System::Drawing::Size(45, 25);
656 | this->FnF9->TabIndex = 9;
657 | this->FnF9->Text = L"F9";
658 | this->FnF9->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
659 | this->FnF9->UseVisualStyleBackColor = true;
660 | this->FnF9->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
661 | //
662 | // FnF10
663 | //
664 | this->FnF10->Appearance = System::Windows::Forms::Appearance::Button;
665 | this->FnF10->Location = System::Drawing::Point(450, 0);
666 | this->FnF10->Margin = System::Windows::Forms::Padding(0);
667 | this->FnF10->Name = L"FnF10";
668 | this->FnF10->Size = System::Drawing::Size(45, 25);
669 | this->FnF10->TabIndex = 10;
670 | this->FnF10->Text = L"F10";
671 | this->FnF10->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
672 | this->FnF10->UseVisualStyleBackColor = true;
673 | this->FnF10->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
674 | //
675 | // FnF11
676 | //
677 | this->FnF11->Appearance = System::Windows::Forms::Appearance::Button;
678 | this->FnF11->Location = System::Drawing::Point(500, 0);
679 | this->FnF11->Margin = System::Windows::Forms::Padding(0);
680 | this->FnF11->Name = L"FnF11";
681 | this->FnF11->Size = System::Drawing::Size(45, 25);
682 | this->FnF11->TabIndex = 11;
683 | this->FnF11->Text = L"F11";
684 | this->FnF11->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
685 | this->FnF11->UseVisualStyleBackColor = true;
686 | this->FnF11->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
687 | //
688 | // FnF12
689 | //
690 | this->FnF12->Appearance = System::Windows::Forms::Appearance::Button;
691 | this->FnF12->Location = System::Drawing::Point(550, 0);
692 | this->FnF12->Margin = System::Windows::Forms::Padding(0);
693 | this->FnF12->Name = L"FnF12";
694 | this->FnF12->Size = System::Drawing::Size(45, 25);
695 | this->FnF12->TabIndex = 12;
696 | this->FnF12->Text = L"F12";
697 | this->FnF12->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
698 | this->FnF12->UseVisualStyleBackColor = true;
699 | this->FnF12->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
700 | //
701 | // FnEject
702 | //
703 | this->FnEject->Appearance = System::Windows::Forms::Appearance::Button;
704 | this->FnEject->Location = System::Drawing::Point(600, 0);
705 | this->FnEject->Margin = System::Windows::Forms::Padding(0);
706 | this->FnEject->Name = L"FnEject";
707 | this->FnEject->Size = System::Drawing::Size(45, 25);
708 | this->FnEject->TabIndex = 13;
709 | this->FnEject->Text = L"▲";
710 | this->FnEject->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
711 | this->FnEject->UseVisualStyleBackColor = true;
712 | this->FnEject->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
713 | //
714 | // FnDel
715 | //
716 | this->FnDel->Appearance = System::Windows::Forms::Appearance::Button;
717 | this->FnDel->Location = System::Drawing::Point(600, 30);
718 | this->FnDel->Margin = System::Windows::Forms::Padding(0);
719 | this->FnDel->Name = L"FnDel";
720 | this->FnDel->Size = System::Drawing::Size(45, 25);
721 | this->FnDel->TabIndex = 14;
722 | this->FnDel->Text = L"delete";
723 | this->FnDel->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
724 | this->FnDel->UseVisualStyleBackColor = true;
725 | this->FnDel->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
726 | //
727 | // FnAlnum
728 | //
729 | this->FnAlnum->Appearance = System::Windows::Forms::Appearance::Button;
730 | this->FnAlnum->Enabled = false;
731 | this->FnAlnum->Location = System::Drawing::Point(150, 90);
732 | this->FnAlnum->Margin = System::Windows::Forms::Padding(0);
733 | this->FnAlnum->Name = L"FnAlnum";
734 | this->FnAlnum->Size = System::Drawing::Size(45, 25);
735 | this->FnAlnum->TabIndex = 15;
736 | this->FnAlnum->Text = L"英数";
737 | this->FnAlnum->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
738 | this->FnAlnum->UseVisualStyleBackColor = true;
739 | this->FnAlnum->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
740 | //
741 | // FnSpace
742 | //
743 | this->FnSpace->Appearance = System::Windows::Forms::Appearance::Button;
744 | this->FnSpace->Enabled = false;
745 | this->FnSpace->Location = System::Drawing::Point(200, 90);
746 | this->FnSpace->Margin = System::Windows::Forms::Padding(0);
747 | this->FnSpace->Name = L"FnSpace";
748 | this->FnSpace->Size = System::Drawing::Size(145, 25);
749 | this->FnSpace->TabIndex = 16;
750 | this->FnSpace->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
751 | this->FnSpace->UseVisualStyleBackColor = true;
752 | this->FnSpace->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
753 | //
754 | // FnKana
755 | //
756 | this->FnKana->Appearance = System::Windows::Forms::Appearance::Button;
757 | this->FnKana->Enabled = false;
758 | this->FnKana->Location = System::Drawing::Point(350, 90);
759 | this->FnKana->Margin = System::Windows::Forms::Padding(0);
760 | this->FnKana->Name = L"FnKana";
761 | this->FnKana->Size = System::Drawing::Size(45, 25);
762 | this->FnKana->TabIndex = 17;
763 | this->FnKana->Text = L"かな";
764 | this->FnKana->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
765 | this->FnKana->UseVisualStyleBackColor = true;
766 | this->FnKana->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
767 | //
768 | // FnUp
769 | //
770 | this->FnUp->Appearance = System::Windows::Forms::Appearance::Button;
771 | this->FnUp->Location = System::Drawing::Point(550, 60);
772 | this->FnUp->Margin = System::Windows::Forms::Padding(0);
773 | this->FnUp->Name = L"FnUp";
774 | this->FnUp->Size = System::Drawing::Size(45, 25);
775 | this->FnUp->TabIndex = 18;
776 | this->FnUp->Text = L"↑";
777 | this->FnUp->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
778 | this->FnUp->UseVisualStyleBackColor = true;
779 | this->FnUp->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
780 | //
781 | // FnLeft
782 | //
783 | this->FnLeft->Appearance = System::Windows::Forms::Appearance::Button;
784 | this->FnLeft->Location = System::Drawing::Point(500, 90);
785 | this->FnLeft->Margin = System::Windows::Forms::Padding(0);
786 | this->FnLeft->Name = L"FnLeft";
787 | this->FnLeft->Size = System::Drawing::Size(45, 25);
788 | this->FnLeft->TabIndex = 19;
789 | this->FnLeft->Text = L"←";
790 | this->FnLeft->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
791 | this->FnLeft->UseVisualStyleBackColor = true;
792 | this->FnLeft->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
793 | //
794 | // FnDown
795 | //
796 | this->FnDown->Appearance = System::Windows::Forms::Appearance::Button;
797 | this->FnDown->Location = System::Drawing::Point(550, 90);
798 | this->FnDown->Margin = System::Windows::Forms::Padding(0);
799 | this->FnDown->Name = L"FnDown";
800 | this->FnDown->Size = System::Drawing::Size(45, 25);
801 | this->FnDown->TabIndex = 20;
802 | this->FnDown->Text = L"↓";
803 | this->FnDown->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
804 | this->FnDown->UseVisualStyleBackColor = true;
805 | this->FnDown->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
806 | //
807 | // FnRight
808 | //
809 | this->FnRight->Appearance = System::Windows::Forms::Appearance::Button;
810 | this->FnRight->Location = System::Drawing::Point(600, 90);
811 | this->FnRight->Margin = System::Windows::Forms::Padding(0);
812 | this->FnRight->Name = L"FnRight";
813 | this->FnRight->Size = System::Drawing::Size(45, 25);
814 | this->FnRight->TabIndex = 21;
815 | this->FnRight->Text = L"→";
816 | this->FnRight->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
817 | this->FnRight->UseVisualStyleBackColor = true;
818 | this->FnRight->CheckedChanged += gcnew System::EventHandler(this, &EditForm::SelectedChanged);
819 | //
820 | // Action
821 | //
822 | this->Action->Controls->Add(this->DoNothing);
823 | this->Action->Controls->Add(this->InputKey);
824 | this->Action->Controls->Add(this->InputKeyList);
825 | this->Action->Controls->Add(this->Special);
826 | this->Action->Controls->Add(this->SpecialList);
827 | this->Action->Controls->Add(this->Exec);
828 | this->Action->Controls->Add(this->ExecCommand);
829 | this->Action->Controls->Add(this->ExecFind);
830 | this->Action->Location = System::Drawing::Point(5, 140);
831 | this->Action->Margin = System::Windows::Forms::Padding(0);
832 | this->Action->Name = L"Action";
833 | this->Action->Size = System::Drawing::Size(450, 70);
834 | this->Action->TabIndex = 1;
835 | this->Action->TabStop = false;
836 | this->Action->Text = L"アクション";
837 | //
838 | // DoNothing
839 | //
840 | this->DoNothing->AutoSize = true;
841 | this->DoNothing->Checked = true;
842 | this->DoNothing->Location = System::Drawing::Point(10, 18);
843 | this->DoNothing->Name = L"DoNothing";
844 | this->DoNothing->Size = System::Drawing::Size(73, 16);
845 | this->DoNothing->TabIndex = 0;
846 | this->DoNothing->TabStop = true;
847 | this->DoNothing->Text = L"何もしない";
848 | this->DoNothing->UseVisualStyleBackColor = true;
849 | this->DoNothing->CheckedChanged += gcnew System::EventHandler(this, &EditForm::DoNothing_CheckedChanged);
850 | //
851 | // InputKey
852 | //
853 | this->InputKey->AutoSize = true;
854 | this->InputKey->Location = System::Drawing::Point(95, 18);
855 | this->InputKey->Name = L"InputKey";
856 | this->InputKey->Size = System::Drawing::Size(43, 16);
857 | this->InputKey->TabIndex = 1;
858 | this->InputKey->TabStop = true;
859 | this->InputKey->Text = L"キー";
860 | this->InputKey->UseVisualStyleBackColor = true;
861 | //
862 | // InputKeyList
863 | //
864 | this->InputKeyList->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
865 | this->InputKeyList->FormattingEnabled = true;
866 | this->InputKeyList->Location = System::Drawing::Point(140, 16);
867 | this->InputKeyList->Name = L"InputKeyList";
868 | this->InputKeyList->Size = System::Drawing::Size(150, 20);
869 | this->InputKeyList->TabIndex = 2;
870 | this->InputKeyList->SelectedIndexChanged += gcnew System::EventHandler(this, &EditForm::InputKeyList_SelectedIndexChanged);
871 | //
872 | // Special
873 | //
874 | this->Special->AutoSize = true;
875 | this->Special->Location = System::Drawing::Point(310, 18);
876 | this->Special->Name = L"Special";
877 | this->Special->Size = System::Drawing::Size(47, 16);
878 | this->Special->TabIndex = 3;
879 | this->Special->TabStop = true;
880 | this->Special->Text = L"特殊";
881 | this->Special->UseVisualStyleBackColor = true;
882 | //
883 | // SpecialList
884 | //
885 | this->SpecialList->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
886 | this->SpecialList->FormattingEnabled = true;
887 | this->SpecialList->Location = System::Drawing::Point(360, 16);
888 | this->SpecialList->Name = L"SpecialList";
889 | this->SpecialList->Size = System::Drawing::Size(80, 20);
890 | this->SpecialList->TabIndex = 4;
891 | this->SpecialList->SelectedIndexChanged += gcnew System::EventHandler(this, &EditForm::SpecialList_SelectedIndexChanged);
892 | //
893 | // Exec
894 | //
895 | this->Exec->AutoSize = true;
896 | this->Exec->Location = System::Drawing::Point(10, 45);
897 | this->Exec->Name = L"Exec";
898 | this->Exec->Size = System::Drawing::Size(47, 16);
899 | this->Exec->TabIndex = 5;
900 | this->Exec->TabStop = true;
901 | this->Exec->Text = L"実行";
902 | this->Exec->UseVisualStyleBackColor = true;
903 | //
904 | // ExecCommand
905 | //
906 | this->ExecCommand->Location = System::Drawing::Point(65, 43);
907 | this->ExecCommand->Name = L"ExecCommand";
908 | this->ExecCommand->Size = System::Drawing::Size(350, 19);
909 | this->ExecCommand->TabIndex = 6;
910 | this->ExecCommand->TextChanged += gcnew System::EventHandler(this, &EditForm::ExecCommand_TextChanged);
911 | //
912 | // ExecFind
913 | //
914 | this->ExecFind->Location = System::Drawing::Point(420, 43);
915 | this->ExecFind->Name = L"ExecFind";
916 | this->ExecFind->Size = System::Drawing::Size(20, 19);
917 | this->ExecFind->TabIndex = 7;
918 | this->ExecFind->Text = L"...";
919 | this->ExecFind->UseVisualStyleBackColor = true;
920 | this->ExecFind->Click += gcnew System::EventHandler(this, &EditForm::ExecFind_Click);
921 | //
922 | // Cancel
923 | //
924 | this->Cancel->DialogResult = System::Windows::Forms::DialogResult::Cancel;
925 | this->Cancel->Location = System::Drawing::Point(470, 180);
926 | this->Cancel->Name = L"Cancel";
927 | this->Cancel->Size = System::Drawing::Size(80, 24);
928 | this->Cancel->TabIndex = 2;
929 | this->Cancel->Text = L"キャンセル";
930 | this->Cancel->UseVisualStyleBackColor = true;
931 | this->Cancel->Click += gcnew System::EventHandler(this, &EditForm::Cancel_Click);
932 | //
933 | // Apply
934 | //
935 | this->Apply->Location = System::Drawing::Point(560, 180);
936 | this->Apply->Name = L"Apply";
937 | this->Apply->Size = System::Drawing::Size(80, 24);
938 | this->Apply->TabIndex = 3;
939 | this->Apply->Text = L"OK";
940 | this->Apply->UseVisualStyleBackColor = true;
941 | this->Apply->Click += gcnew System::EventHandler(this, &EditForm::Apply_Click);
942 | //
943 | // FileDlg
944 | //
945 | this->FileDlg->AddExtension = false;
946 | //
947 | // EditForm
948 | //
949 | this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
950 | this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
951 | this->CancelButton = this->Cancel;
952 | this->ClientSize = System::Drawing::Size(654, 216);
953 | this->Controls->Add(this->Action);
954 | this->Controls->Add(this->Tab);
955 | this->Controls->Add(this->Cancel);
956 | this->Controls->Add(this->Apply);
957 | this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow;
958 | this->ImeMode = System::Windows::Forms::ImeMode::Off;
959 | this->MaximizeBox = false;
960 | this->MinimizeBox = false;
961 | this->Name = L"EditForm";
962 | this->ShowIcon = false;
963 | this->ShowInTaskbar = false;
964 | this->Text = L"Apple Keyboard Bridge - Configuration Editor";
965 | this->Load += gcnew System::EventHandler(this, &EditForm::EditForm_Load);
966 | this->Tab->ResumeLayout(false);
967 | this->Singles->ResumeLayout(false);
968 | this->Combinations->ResumeLayout(false);
969 | this->Action->ResumeLayout(false);
970 | this->Action->PerformLayout();
971 | this->ResumeLayout(false);
972 | }
973 | #pragma endregion
974 |
975 | private:
976 | System::Void EditForm_Load(System::Object^ /*sender*/, System::EventArgs^ /*e*/);
977 | System::Void Cancel_Click(System::Object^ /*sender*/, System::EventArgs^ /*e*/);
978 | System::Void Apply_Click(System::Object^ /*sender*/, System::EventArgs^ /*e*/);
979 | System::Void ExecFind_Click(System::Object^ /*sender*/, System::EventArgs^ /*e*/);
980 | System::Void SelectedChanged(System::Object^ /*sender*/, System::EventArgs^ /*e*/);
981 | System::Void DoNothing_CheckedChanged(System::Object^ /*sender*/, System::EventArgs^ /*e*/);
982 | System::Void InputKeyList_SelectedIndexChanged(System::Object^ /*sender*/, System::EventArgs^ /*e*/);
983 | System::Void SpecialList_SelectedIndexChanged(System::Object^ /*sender*/, System::EventArgs^ /*e*/);
984 | System::Void ExecCommand_TextChanged(System::Object^ /*sender*/, System::EventArgs^ /*e*/);
985 |
986 | private:
987 | void LoadResources();
988 | void LoadConfig(array^ /*args*/);
989 | bool SaveConfig();
990 | void ShowAction(WORD);
991 | WORD% GetSelectedAction();
992 | void ResetActionsExceptFor(System::Windows::Forms::Control^);
993 |
994 | private:
995 | System::String^ ConfigPath;
996 | Config^ ConfigData;
997 | array^ ConfigCmds;
998 | System::Boolean IsSuspended;
999 |
1000 | private:
1001 | System::Collections::Generic::Dictionary^ InputKeys;
1002 | System::Collections::Generic::Dictionary^ Specials;
1003 | };
1004 | }
1005 |
--------------------------------------------------------------------------------
/akbcf/EditForm.resX:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/akbcf/acl.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Apple Keyboard Bridge https://github.com/andantissimo/Apple-Keyboard-Bridge
3 | */
4 | #pragma once
5 |
6 | namespace Acl
7 | {
8 | public ref class Principal
9 | {
10 | public:
11 | typedef System::Security::AccessControl::FileSystemRights Rights;
12 |
13 | public:
14 | static property Principal^ Current
15 | {
16 | Principal^ get()
17 | {
18 | return gcnew Principal(
19 | gcnew System::Security::Principal::WindowsPrincipal(
20 | System::Security::Principal::WindowsIdentity::GetCurrent()
21 | )
22 | );
23 | }
24 | }
25 |
26 | public:
27 | Principal(System::Security::Principal::WindowsPrincipal^ user)
28 | : _user(user)
29 | {
30 | }
31 |
32 | bool HasRight(System::Security::AccessControl::FileSystemSecurity^ sec, Rights right)
33 | {
34 | using namespace System::Security::Principal;
35 | using namespace System::Security::AccessControl;
36 | bool allowed = false;
37 | for each (FileSystemAccessRule^ rule in
38 | sec->GetAccessRules(true, true, SecurityIdentifier::typeid))
39 | {
40 | SecurityIdentifier^ sid
41 | = static_cast(rule->IdentityReference);
42 | if ((rule->FileSystemRights == right ||
43 | rule->FileSystemRights == FileSystemRights::FullControl) &&
44 | _user->IsInRole(sid))
45 | {
46 | if (rule->AccessControlType == AccessControlType::Deny)
47 | return false;
48 | if (rule->AccessControlType == AccessControlType::Allow)
49 | allowed = true;
50 | }
51 | }
52 | return allowed;
53 | }
54 | bool HasRight(System::String^ path, Rights right)
55 | {
56 | using namespace System::IO;
57 | return File::Exists(path)
58 | ? HasRight(File::GetAccessControl(path), right)
59 | : HasRight(Directory::GetAccessControl(Path::GetDirectoryName(path)), right);
60 | }
61 |
62 | void AddRight(System::Security::AccessControl::FileSystemSecurity^ sec, Rights right)
63 | {
64 | using namespace System::Security::Principal;
65 | using namespace System::Security::AccessControl;
66 | System::Collections::Generic::List denies;
67 | bool allowed = false;
68 | for each (FileSystemAccessRule^ rule in
69 | sec->GetAccessRules(true, true, SecurityIdentifier::typeid))
70 | {
71 | SecurityIdentifier^ sid
72 | = static_cast(rule->IdentityReference);
73 | if ((rule->FileSystemRights == right ||
74 | rule->FileSystemRights == FileSystemRights::FullControl) &&
75 | _user->IsInRole(sid))
76 | {
77 | if (rule->AccessControlType == AccessControlType::Deny)
78 | denies.Add(rule);
79 | if (rule->AccessControlType == AccessControlType::Allow)
80 | allowed = true;
81 | }
82 | }
83 | for each (FileSystemAccessRule^ rule in denies) {
84 | sec->RemoveAccessRule(rule);
85 | }
86 | if (!allowed) {
87 | FileSystemAccessRule^ rule = gcnew FileSystemAccessRule(
88 | _user->Identity->Name, right, AccessControlType::Allow);
89 | sec->AddAccessRule(rule);
90 | }
91 | }
92 | void AddRight(System::String^ path, Rights right)
93 | {
94 | using namespace System::IO;
95 | using namespace System::Security::Principal;
96 | using namespace System::Security::AccessControl;
97 | if (File::Exists(path)) {
98 | FileSecurity^ sec = File::GetAccessControl(path);
99 | AddRight(sec, right);
100 | File::SetAccessControl(path, sec);
101 | } else {
102 | System::String^ dir = Path::GetDirectoryName(path);
103 | DirectorySecurity^ sec = Directory::GetAccessControl(dir);
104 | AddRight(sec, right);
105 | Directory::SetAccessControl(dir, sec);
106 | }
107 | }
108 |
109 | private:
110 | System::Security::Principal::WindowsPrincipal^ _user;
111 | };
112 | }
113 |
--------------------------------------------------------------------------------
/akbcf/akbcf.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Apple Keyboard Bridge https://github.com/andantissimo/Apple-Keyboard-Bridge
3 | */
4 | #include "EditForm.h"
5 |
6 | using namespace System;
7 | using namespace System::Threading;
8 | using namespace System::Windows::Forms;
9 |
10 | [STAThreadAttribute]
11 | int main(array^ args)
12 | {
13 | // start mutex by current directory
14 | String^ name = AppDomain::CurrentDomain->BaseDirectory->Replace('\\', '/');
15 | Mutex mutex(false, name);
16 | if (args->Length > 0) {
17 | // elevating: wait until non-elevated instance exits
18 | if (!mutex.WaitOne(5 * 1000, false))
19 | return 0;
20 | } else {
21 | // normal: exit right now
22 | if (!mutex.WaitOne(0, false))
23 | return 0;
24 | }
25 |
26 | Application::EnableVisualStyles();
27 | Application::SetCompatibleTextRenderingDefault(false);
28 | Application::Run(gcnew akbcf::EditForm(args));
29 | return 0;
30 | }
31 |
--------------------------------------------------------------------------------
/akbcf/akbcf.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {1D163A1A-D710-4964-A1F8-8D332DF5B02C}
15 | akbcf
16 | ManagedCProj
17 | 8.1
18 |
19 |
20 |
21 | Application
22 | v141_xp
23 | Unicode
24 | true
25 |
26 |
27 |
28 |
29 | Application
30 | v141_xp
31 | Unicode
32 | true
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | <_ProjectFileVersion>14.0.23107.0
47 |
48 |
49 | $(SolutionDir)bin\$(Configuration)\
50 | $(SolutionDir)obj\$(Configuration)\$(ProjectName)\
51 | true
52 |
53 |
54 | $(SolutionDir)bin\$(Configuration)\
55 | $(SolutionDir)obj\$(Configuration)\$(ProjectName)\
56 | false
57 |
58 |
59 |
60 | $(IntDir)$(ProjectName).htm
61 |
62 |
63 | Disabled
64 | WIN32;_DEBUG;%(PreprocessorDefinitions)
65 | MultiThreadedDebugDLL
66 | true
67 |
68 | $(IntDir)$(TargetName).pdb
69 | Level4
70 | ProgramDatabase
71 |
72 |
73 |
74 | Debug
75 | true
76 | Windows
77 | main
78 | MachineX86
79 |
80 |
81 |
82 |
83 | $(IntDir)$(ProjectName).htm
84 |
85 |
86 | Full
87 | Size
88 | true
89 | true
90 | WIN32;NDEBUG;%(PreprocessorDefinitions)
91 | true
92 | MultiThreadedDLL
93 | false
94 |
95 | $(IntDir)$(TargetName).pdb
96 | Level4
97 | ProgramDatabase
98 |
99 |
100 |
101 | No
102 | Windows
103 | true
104 | true
105 | main
106 | MachineX86
107 |
108 |
109 |
110 |
111 | true
112 | true
113 |
114 |
115 | true
116 | true
117 |
118 |
119 | true
120 | true
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 | CppForm
132 |
133 |
134 |
135 |
136 | EditForm.h
137 | Designer
138 |
139 |
140 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/akbcf/akbcf.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 |
14 |
15 | Source Files
16 |
17 |
18 | Source Files
19 |
20 |
21 | Source Files
22 |
23 |
24 |
25 |
26 | Header Files
27 |
28 |
29 | Header Files
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/common/akb.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Apple Keyboard Bridge https://github.com/andantissimo/Apple-Keyboard-Bridge
3 | */
4 | #pragma once
5 |
6 | #ifndef _MANAGED
7 | #define _WIN32_WINNT 0x0501
8 | #define WIN32_LEAN_AND_MEAN
9 | #include
10 | #include
11 | #else
12 | #include "wincli.h"
13 | #endif
14 |
15 | #include "hybrid.h"
16 |
17 | #ifndef _MANAGED
18 | const struct App
19 | {
20 | LPCTSTR Class;
21 | LPCTSTR Title;
22 | } App =
23 | {
24 | TEXT("APPLE_KEYBOARD_BRIDGE"),
25 | TEXT("Apple Keyboard Bridge"),
26 | };
27 | #else
28 | public value struct App
29 | {
30 | literal System::String^ Class = L"APPLE_KEYBOARD_BRIDGE";
31 | literal System::String^ Title = L"Apple Keyboard Bridge";
32 | };
33 | #endif
34 |
35 | enum
36 | {
37 | WM_APP_RELOAD = WM_APP + 1,
38 | };
39 |
40 | enum
41 | {
42 | CONFIG_SIGNATURE = ('A' | 'K' << 8 | 'B' << 16),
43 | CONFIG_NUM_CMDS = 8,
44 | };
45 | typedef nopadding ref_struct Config
46 | {
47 | DWORD Signature;
48 | val_struct Key
49 | {
50 | WORD Power, Eject, Alnum, Kana;
51 | } Key;
52 | val_struct Fn
53 | {
54 | WORD F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12;
55 | WORD Del, Up, Down, Left, Right, Eject;
56 | } Fn;
57 | /* WORD cbCmd[CONFIG_NUM_CMDS] */
58 | fixed_array(WORD, cbCmds, CONFIG_NUM_CMDS);
59 | } Config;
60 |
61 | enum
62 | {
63 | FIRE_NOTHING = 0xFFFF,
64 | FIRE_POWER = 0xFFFE,
65 | FIRE_EJECT = 0xFFFD,
66 | FIRE_FLIP3D = 0xFFFC,
67 | FIRE_BRIGHT_UP = 0xFFFB,
68 | FIRE_BRIGHT_DN = 0xFFFA,
69 | FIRE_ALPHA_UP = 0xFFF9,
70 | FIRE_ALPHA_DN = 0xFFF8,
71 | FIRE_CMD_0 = 0xFF00,
72 | };
73 | enum
74 | {
75 | /* single action keys */
76 | CONFIG_INIT_KEY_POWER = FIRE_POWER,
77 | CONFIG_INIT_KEY_EJECT = VK_F13,
78 | CONFIG_INIT_KEY_ALNUM = VK_NONCONVERT,
79 | CONFIG_INIT_KEY_KANA = VK_CONVERT,
80 | /* Fn combination keys */
81 | CONFIG_INIT_FN_F1 = FIRE_BRIGHT_DN,
82 | CONFIG_INIT_FN_F2 = FIRE_BRIGHT_UP,
83 | CONFIG_INIT_FN_F3 = FIRE_FLIP3D,
84 | CONFIG_INIT_FN_F4 = FIRE_NOTHING,
85 | CONFIG_INIT_FN_F5 = FIRE_NOTHING,
86 | CONFIG_INIT_FN_F6 = FIRE_NOTHING,
87 | CONFIG_INIT_FN_F7 = VK_MEDIA_PREV_TRACK,
88 | CONFIG_INIT_FN_F8 = VK_MEDIA_PLAY_PAUSE,
89 | CONFIG_INIT_FN_F9 = VK_MEDIA_NEXT_TRACK,
90 | CONFIG_INIT_FN_F10 = VK_VOLUME_MUTE,
91 | CONFIG_INIT_FN_F11 = VK_VOLUME_DOWN,
92 | CONFIG_INIT_FN_F12 = VK_VOLUME_UP,
93 | CONFIG_INIT_FN_DEL = VK_DELETE,
94 | CONFIG_INIT_FN_UP = VK_PRIOR,
95 | CONFIG_INIT_FN_DOWN = VK_NEXT,
96 | CONFIG_INIT_FN_LEFT = VK_HOME,
97 | CONFIG_INIT_FN_RIGHT = VK_END,
98 | CONFIG_INIT_FN_EJECT = FIRE_EJECT,
99 | };
100 |
101 | enum
102 | {
103 | BRIGHT_STEP = 10,
104 | ALPHA_DELTA = 0xFF / 5
105 | };
106 |
--------------------------------------------------------------------------------
/common/hybrid.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Apple Keyboard Bridge https://github.com/andantissimo/Apple-Keyboard-Bridge
3 | */
4 | #pragma once
5 |
6 | #ifndef _MANAGED
7 |
8 | #define nopadding __declspec(align(1))
9 |
10 | #define ref_struct struct
11 | #define val_struct struct
12 |
13 | #define fixed_array(_type, _name, _size) _type _name[_size]
14 |
15 | #else/*!_MANAGED*/
16 |
17 | #define nopadding \
18 | [System::Runtime::InteropServices::StructLayout( \
19 | System::Runtime::InteropServices::LayoutKind::Sequential)]
20 |
21 | #define ref_struct ref struct
22 | #define val_struct value struct
23 |
24 | #define fixed_array(_type, _name, _size) \
25 | [System::Runtime::InteropServices::MarshalAs( \
26 | System::Runtime::InteropServices::UnmanagedType::ByValArray, \
27 | SizeConst=_size)] \
28 | array<_type>^ _name;
29 |
30 | #endif/*_MANAGED*/
31 |
--------------------------------------------------------------------------------
/common/wincli.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Apple Keyboard Bridge https://github.com/andantissimo/Apple-Keyboard-Bridge
3 | */
4 | #pragma once
5 |
6 | typedef System::UInt32 DWORD, ULONG, UINT;
7 | typedef System::UInt16 WORD, USHORT;
8 | typedef System::Byte BYTE;
9 | typedef System::Int32 BOOL;
10 | typedef System::IntPtr HANDLE, HWND;
11 | typedef System::IntPtr LRESULT, WPARAM, LPARAM;
12 |
13 | enum
14 | {
15 | FALSE = 0, TRUE = 1
16 | };
17 |
18 | enum
19 | {
20 | WM_APP = 0x8000,
21 | };
22 |
23 | enum
24 | {
25 | BCM_SETSHIELD = 0x160C,
26 | };
27 |
28 | enum
29 | {
30 | VK_KANJI = 0x19,
31 | VK_CONVERT = 0x1C,
32 | VK_NONCONVERT = 0x1D,
33 |
34 | VK_PRIOR = 0x21, // Page Up
35 | VK_NEXT = 0x22, // Page Down
36 | VK_END = 0x23,
37 | VK_HOME = 0x24,
38 |
39 | VK_SNAPSHOT = 0x2C, // Print Screen
40 | VK_INSERT = 0x2D,
41 | VK_DELETE = 0x2E,
42 |
43 | VK_F1 = 0x70,
44 | VK_F2 = 0x71,
45 | VK_F3 = 0x72,
46 | VK_F4 = 0x73,
47 | VK_F5 = 0x74,
48 | VK_F6 = 0x75,
49 | VK_F7 = 0x76,
50 | VK_F8 = 0x77,
51 | VK_F9 = 0x78,
52 | VK_F10 = 0x79,
53 | VK_F11 = 0x7A,
54 | VK_F12 = 0x7B,
55 | VK_F13 = 0x7C,
56 | VK_F14 = 0x7D,
57 | VK_F15 = 0x7E,
58 | VK_F16 = 0x7F,
59 | VK_F17 = 0x80,
60 | VK_F18 = 0x81,
61 | VK_F19 = 0x82,
62 | VK_F20 = 0x83,
63 | VK_F21 = 0x84,
64 | VK_F22 = 0x85,
65 | VK_F23 = 0x86,
66 | VK_F24 = 0x87,
67 |
68 | VK_BROWSER_BACK = 0xA6,
69 | VK_BROWSER_FORWARD = 0xA7,
70 | VK_BROWSER_REFRESH = 0xA8,
71 | VK_BROWSER_STOP = 0xA9,
72 | VK_BROWSER_SEARCH = 0xAA,
73 | VK_BROWSER_FAVORITES = 0xAB,
74 | VK_BROWSER_HOME = 0xAC,
75 | VK_VOLUME_MUTE = 0xAD,
76 | VK_VOLUME_DOWN = 0xAE,
77 | VK_VOLUME_UP = 0xAF,
78 | VK_MEDIA_NEXT_TRACK = 0xB0,
79 | VK_MEDIA_PREV_TRACK = 0xB1,
80 | VK_MEDIA_STOP = 0xB2,
81 | VK_MEDIA_PLAY_PAUSE = 0xB3,
82 | VK_LAUNCH_MAIL = 0xB4,
83 | };
84 |
85 | [System::Runtime::InteropServices::DllImport("user32.dll", CharSet=System::Runtime::InteropServices::CharSet::Auto)]
86 | HWND FindWindow(System::String^, System::String^);
87 |
88 | [System::Runtime::InteropServices::DllImport("user32.dll", CharSet=System::Runtime::InteropServices::CharSet::Auto)]
89 | LRESULT PostMessage(HWND, UINT, WPARAM, LPARAM);
90 |
91 | [System::Runtime::InteropServices::DllImport("user32.dll", CharSet=System::Runtime::InteropServices::CharSet::Auto)]
92 | LRESULT SendMessage(HWND, UINT, WPARAM, LPARAM);
93 |
--------------------------------------------------------------------------------
/doc/akb.txt:
--------------------------------------------------------------------------------
1 |
2 | Apple Keyboard Bridge ver.0.1.3
3 |
4 | はじめに
5 | Apple Keyboard Bridge (以下 akb) は、Apple Wireless Keyboard の、
6 | 通常 Windows では使用できないキー (Fnなど) を入力可能にするための
7 | ユーティリティです。
8 |
9 | 使用方法
10 | 任意の場所に置いて akb.exe を実行するだけでOKです。
11 |
12 | 設定方法
13 | キー割り当てを変更するには akbcf.exe を起動します。
14 | akbcf.exe の起動には .NET Framework 4.0 が必要です。
15 | (下記のデフォルト設定のままで良ければ設定は不要です。
16 | akb.exe の起動には特にランタイムなどを必要としません。)
17 |
18 | キー割り当て初期設定値
19 | Eject … F13
20 | Delete … Back Space
21 | 英数 … 無変換
22 | かな … 変換
23 | Fn + F1 … 暗く (Vista 以降のみ)
24 | Fn + F2 … 明るく (Vista 以降のみ)
25 | Fn + F3 … フリップ3D (Vista 以降のみ)
26 | Fn + F4 … 何もしない
27 | Fn + F5 … 何もしない
28 | Fn + F6 … 何もしない
29 | Fn + F7 … 前のトラックへ
30 | Fn + F8 … 再生/一時停止
31 | Fn + F9 … 次のトラックへ
32 | Fn + F10 … ミュート
33 | Fn + F11 … 音量を下げる
34 | Fn + F12 … 音量を上げる
35 | Fn + Eject … CD取り出し
36 | Fn + Delete … Delete
37 | Fn + ↑ … Page Up
38 | Fn + ↓ … Page Down
39 | Fn + ← … Home
40 | Fn + → … End
41 |
42 | 制限事項
43 | 外部コマンド実行は8個までしか登録できません。
44 |
45 | 動作確認済み環境
46 | Windows XP, 7, 10 + Apple Wireless Keyboard JIS 2009
47 | + Windows標準Bluetoothスタック
48 |
49 | 更新履歴
50 | ver 0.1.3 Apple Magic Keyboard JIS/US 2015 対応
51 | モニタを暗く/明るくするコマンドを追加
52 | ver 0.1.2 キー割り当て候補に「全角/半角」キー追加
53 | ver 0.1.1 Apple Wireless Keyboard JIS/US 2011 対応
54 | ver 0.1.0 特殊コマンドに 透明/不透明 追加
55 | 設定エディタがUAC昇格時に状態引継ぎ失敗
56 | することがあったのを修正
57 |
58 | ライセンス
59 | BSDライセンスを適用します。
60 |
61 | 連絡先
62 | Web : https://github.com/andantissimo/Apple-Keyboard-Bridge
63 | E-Mail : contact@andantissimo.jp
64 |
--------------------------------------------------------------------------------
/release.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | set OUTPUT=bin\Release
4 | set TARGET=bin\akb
5 | if exist %OUTPUT%\akb.exe (
6 | if not exist %TARGET% mkdir %TARGET%
7 | copy /y doc\akb.txt %TARGET%\ > nul
8 | copy /y %OUTPUT%\akb.exe %TARGET%\ > nul
9 | copy /y %OUTPUT%\akbcf.exe %TARGET%\ > nul
10 | )
11 |
--------------------------------------------------------------------------------