Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Disabling drag-and-drop globally.

Name: Anonymous 2010-07-07 1:18

Is there a way to set up my mouse so a "click" consists of only pressing the button DOWN, instead of waiting for the up click?  I tried setting a global mouse hook and using SendInput to send an MOUSEEVENTF_LEFTUP message every time it gets a WM_LBUTTONDOWN message, but it doesn't do what I want.

I need it so I can get faster @ Minesweeper. :3  I always wind up clicking different squares than I mean to, because by the time I lift up on the button, I've moved my mouse somewhere else.

Name: Anonymous 2010-07-07 6:07

OP here, I figured it out.  Automatically generating an upclick within my mouse hook after every downclick wasn't working because it was processing the upclick before I exited my hook to let the system process the downclick. The answer was to kill EVERY user-generated (left button) mouse event and send a down/upclick combo on each downclick.

Code if anyone's interested ('flag' is a global variable):


int flag;
...
SetWindowsHookEx(WH_MOUSE_LL, MouseProc, hInst, 0);
...
LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam) {
    INPUT I[2];

    if (nCode == HC_ACTION && wParam == WM_LBUTTONUP) {
        if (flag == 0)
            return -1;
        else
            flag = 0;
    }

    if (nCode == HC_ACTION && wParam == WM_LBUTTONDOWN) {
        if (flag == 0) {
            flag = 1;

            memset(I, 0, 2*sizeof(INPUT));
            I[0].type = I[1].type = INPUT_MOUSE;
            I[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
            I[1].mi.dwFlags = MOUSEEVENTF_LEFTUP;
            SendInput(2, I, sizeof(INPUT));

            return -1;
        }
    }

    return CallNextHookEx(mHook, nCode, wParam, lParam);
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List