Skip to content

Commit

Permalink
Removed code to prevent alt key's keyup event. It caused more trouble…
Browse files Browse the repository at this point in the history
… than it solved.

Release 0.2.
  • Loading branch information
stefansundin committed Aug 1, 2008
1 parent 550340b commit 983780a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 30 deletions.
2 changes: 1 addition & 1 deletion altdrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
SetAutostart(1,0);
}
else if (wmId == SWM_ABOUT) {
MessageBox(NULL, "AltDrag - 0.1\nhttp://altdrag.googlecode.com/\nrecover89@gmail.com\n\nDrag windows with the mouse when pressing the alt key.\n\nYou can use -hide as a parameter to hide the tray icon.\n\nSend feedback to recover89@gmail.com", "About AltDrag", MB_ICONINFORMATION|MB_OK);
MessageBox(NULL, "AltDrag - 0.2\nhttp://altdrag.googlecode.com/\nrecover89@gmail.com\n\nDrag windows with the mouse when pressing the alt key.\n\nYou can use -hide as a parameter to hide the tray icon.\n\nSend feedback to recover89@gmail.com", "About AltDrag", MB_ICONINFORMATION|MB_OK);
}
else if (wmId == SWM_EXIT) {
DestroyWindow(hWnd);
Expand Down
26 changes: 0 additions & 26 deletions hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ static int alt=0;
static int move=0;
static HWND hwnd=NULL;
static POINT offset;
static int preventkeyup=0;

static char msg[100];

Expand All @@ -41,11 +40,6 @@ _declspec(dllexport) LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPA
}
else if (wParam == WM_KEYUP || wParam == WM_SYSKEYUP) {
alt=0;
//Prevent the keyup if this alt press was involved in dragging a window
if (preventkeyup) {
preventkeyup=0;
return 1;
}
}
}
}
Expand Down Expand Up @@ -118,26 +112,6 @@ _declspec(dllexport) LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM
}
//Ready to move window
move=1;
//Send the window a control and alt keyup. Then prevent it from receiving the real alt keyup, to prevent behavior like selecting the menu in the active window
KEYBDINPUT ki_control;
ki_control.wVk=VK_CONTROL;
ki_control.dwFlags=KEYEVENTF_KEYUP;
ki_control.time=0;

KEYBDINPUT ki_alt;
ki_alt.wVk=VK_MENU;
ki_alt.dwFlags=KEYEVENTF_KEYUP;
ki_alt.time=0;

INPUT keys[2];
keys[0].type=INPUT_KEYBOARD;
keys[0].ki=ki_control;
keys[1].type=INPUT_KEYBOARD;
keys[1].ki=ki_alt;

SendInput(2, keys, sizeof(INPUT));

preventkeyup=1;
//Prevent mousedown from propagating
return 1;
}
Expand Down
6 changes: 3 additions & 3 deletions resources.rc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "AltDrag.exe.manifest"

#define VS_VERSION_INFO 1
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,1,0,0
PRODUCTVERSION 0,1,0,0
FILEVERSION 0,2,0,0
PRODUCTVERSION 0,2,0,0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L
Expand All @@ -21,7 +21,7 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "AltDrag"
VALUE "FileVersion", "0.1"
VALUE "FileVersion", "0.2"
VALUE "InternalName", "altdrag"
VALUE "LegalCopyright", "� Stefan Sundin 2008"
VALUE "OriginalFilename", "AltDrag.exe"
Expand Down

0 comments on commit 983780a

Please sign in to comment.