Skip to content

Commit 9bc4e58

Browse files
committed
ahkmingw exported dllmain
1 parent 108d947 commit 9bc4e58

File tree

6 files changed

+21
-16
lines changed

6 files changed

+21
-16
lines changed

AutoHotkeyx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ EXPORT int ahkdll(char *fileName, char *argv, char *args)
362362
// probably for window creation
363363
// Todo: better cleanup in DLL_PROCESS_DETACH: windows, variables, no exit from script
364364

365-
BOOL WINAPI DllMain(HINSTANCE hInstance,DWORD fwdReason, LPVOID lpvReserved)
365+
EXPORT BOOL WINAPI DllMain(HINSTANCE hInstance,DWORD fwdReason, LPVOID lpvReserved)
366366
{
367367
switch(fwdReason)
368368
{

ahkmingw_linux.depend

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
"keyboard_mouse.h"
3535
"script.h"
3636

37-
1252537421 /home/naveen/source/ahkmingw/keyboard_mouse.h
37+
1253411318 /home/naveen/source/ahkmingw/keyboard_mouse.h
3838
"defines.h"
3939

40-
1252041773 /home/naveen/source/ahkmingw/defines.h
40+
1253411318 /home/naveen/source/ahkmingw/defines.h
4141
"stdafx.h"
4242
<pshpack1.h>
4343
<pshpack4.h>
@@ -139,7 +139,7 @@
139139
"globaldata.h"
140140
"window.h"
141141

142-
1251585310 source:/home/naveen/source/ahkmingw/keyboard_mouse.cpp
142+
1253412186 source:/home/naveen/source/ahkmingw/keyboard_mouse.cpp
143143
"stdafx.h"
144144
"keyboard_mouse.h"
145145
"globaldata.h"
@@ -272,7 +272,7 @@
272272
"resource.h"
273273
<winresrc.h>
274274

275-
1253159917 source:/home/naveen/source/ahkmingw/script.cpp
275+
1253411318 source:/home/naveen/source/ahkmingw/script.cpp
276276
"stdafx.h"
277277
"script.h"
278278
"globaldata.h"
@@ -433,7 +433,7 @@
433433
"var.h"
434434
"globaldata.h"
435435

436-
1253155728 source:/home/naveen/source/ahkmingw/window.cpp
436+
1253414384 source:/home/naveen/source/ahkmingw/window.cpp
437437
"stdafx.h"
438438
"window.h"
439439
"util.h"
@@ -710,7 +710,7 @@
710710

711711
1252537421 /home/naveen/source/ahkmingw/exports.h
712712

713-
1253336267 source:/home/naveen/source/ahkmingw/exports.cpp
713+
1253413540 source:/home/naveen/source/ahkmingw/exports.cpp
714714
"stdafx.h"
715715
"globaldata.h"
716716
"application.h"

bin/send.ahk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
; #InstallKeybdHook
2-
; #UseHook
1+
#InstallKeybdHook
2+
#UseHook
33
; SendMode Input
44

5-
#IfWinActive emacs
5+
#IfWinActive Z
66
a::
77
msgbox test
88
return

exports.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ EXPORT int ahkLabel(char *aLabelName)
5757

5858
EXPORT int ahkKey(char *keys) // N11 sendahk
5959
{
60-
SendKeys(keys, false, SM_EVENT, 0, 1);
60+
// SendKeys(keys, false, SM_EVENT, 0, 1);
61+
sc_type aSC = TextToSC(keys);
62+
vk_type aVK = TextToVK(keys);
63+
// KeyEvent(KEYDOWNANDUP, aVK, 0, 0, false, 0);
64+
keybd_event((byte)aVK, (byte)aSC, 0, 0);
65+
6166
return 0;
6267
}
6368

keyboard_mouse.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void SendKeys(char *aKeys, bool aSendRaw, SendModes aSendModeOrig, HWND aTargetW
133133
keybd_layout_thread = GetWindowThreadProcessId(active_window, NULL);
134134
//else no foreground window, so keep keybd_layout_thread at default.
135135
}
136-
sTargetKeybdLayout = GetKeyboardLayout(keybd_layout_thread); // If keybd_layout_thread==0, this will get our thread's own layout, which seems like the best/safest default.
136+
sTargetKeybdLayout = g_HKL; // N11 GetKeyboardLayout(keybd_layout_thread); // If keybd_layout_thread==0, this will get our thread's own layout, which seems like the best/safest default.
137137
sTargetLayoutHasAltGr = LayoutHasAltGr(sTargetKeybdLayout); // Note that WM_INPUTLANGCHANGEREQUEST is not monitored by MsgSleep for the purpose of caching our thread's keyboard layout. This is because it would be unreliable if another msg pump such as MsgBox is running. Plus it hardly helps perf. at all, and hurts maintainability.
138138

139139
// Below is now called with "true" so that the hook's modifier state will be corrected (if necessary)
@@ -1552,8 +1552,8 @@ void KeyEvent(KeyEventTypes aEventType, vk_type aVK, sc_type aSC, HWND aTargetWi
15521552
{
15531553
// Below is similar to the macro "Get_active_window_keybd_layout":
15541554
HWND active_window;
1555-
target_keybd_layout = GetKeyboardLayout((active_window = GetForegroundWindow())\
1556-
? GetWindowThreadProcessId(active_window, NULL) : 0); // When no foreground window, the script's own layout seems like the safest default.
1555+
target_keybd_layout = g_HKL ;// N11 GetKeyboardLayout((active_window = GetForegroundWindow())\
1556+
// ? GetWindowThreadProcessId(active_window, NULL) : 0); // When no foreground window, the script's own layout seems like the safest default.
15571557
target_layout_has_altgr = LayoutHasAltGr(target_keybd_layout); // In the case of this else's "if", target_layout_has_altgr was already set properly higher above.
15581558
}
15591559
if (target_layout_has_altgr != LAYOUT_UNDETERMINED) // This layout's AltGr status is already known with certainty.

window.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,11 @@ HWND WinExist(global_struct &aSettings, char *aTitle, char *aText, char *aExclud
548548
{
549549
if (g_script.xwingetid) // ahkxN11
550550
{
551-
printf("trying winexist %s", aTitle); // todo: remove this debug line
551+
// printf("trying winexist %s", aTitle); // todo: remove this debug line
552552
int xwin = g_script.xwingetid(aTitle);
553553
if (xwin)
554554
{
555-
printf("exists %s %d", aTitle, xwin); // todo: remove this debug line
555+
// printf("exists %s %d", aTitle, xwin); // todo: remove this debug line
556556
return (HWND)xwin;
557557
}
558558
}

0 commit comments

Comments
 (0)