Hi, how would I use mouse_event to simulate the mouse wheel? I can only do clicks.

void Left_Click(const long x, const long y)
{
    mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
    mouse_event(MOUSEEVENTF_LEFTUP,x,y,0,0);
}
void Right_Click(const long x, const long y)
{
    mouse_event(MOUSEEVENTF_RIGHTDOWN, x, y, 0, 0);
    mouse_event(MOUSEEVENTF_RIGHTUP, x, y, 0, 0);
}

Recommended Answers

not sure, but for doing clicks, you can just do:

mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, x, y, 0, 0);

for a right click

Jump to Post

All 3 Replies

not sure, but for doing clicks, you can just do:

mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, x, y, 0, 0);

for a right click

I looked around for a while. I'm going to use SendInput now. It works.

mouse_event( dwFlags = MOUSEEVENTF_RIGHTUP, dx, dy, 0, 0);/////Relase left Click'
mouse_event( dwFlags = MOUSEEVENTF_RIGHTDOWN, dx, dy, 0, 0);////Push left Click'
mouse_event( dwFlags = MOUSEEVENTF_RIGHTUP, dx, dy, 0, 0);/////Relase left Click'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.