1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
void Auto_Scroll (LONG pGT_X, LONG pGT_Y, long pScreen_Res_X, long pScreen_Res_Y)
{
int Vscroll_type;
int Hscroll_type;
int App_win_tX, App_win_bX, App_win_tY, App_win_bY;
int *pVscroll_type = &Vscroll_type;
int *pHscroll_type = &Hscroll_type;
int *pApp_win_tX = &App_win_tX;
int *pApp_win_bX = &App_win_bX;
int *pApp_win_tY = &App_win_tY;
int *pApp_win_bY = &App_win_bY;
//check cout << "Screen size x-axis: " << pScreen_Res_X << endl; //Prints x-axis size
//check cout << "Screen size y-axis: " << pScreen_Res_Y << endl; //Prints y-axis size
//call function in the code below for 2nd question
app_size(pApp_win_tX, pApp_win_bX, pApp_win_tY, pApp_win_bY);
printf ("screen top x coordinates: %d, screen bottom x coordinates: %d, screen top y coordinates: %d, screen bottom y coordinates: %d\n"
, *pApp_win_tX, *pApp_win_bX, *pApp_win_tY, *pApp_win_bY );
//+ for up scroll; - for down scroll
if ((Activate_Vscroll(pGT_Y, pScreen_Res_Y, pVscroll_type)) == TRUE)
{
DWORD GTEvent = MOUSEEVENTF_WHEEL; //sets mouse event to vertical wheel
switch (*pVscroll_type)
{
case 1:
mouse_event ( GTEvent, pGT_X, pGT_Y, +10, 0); //scrolls up
//check cout << "Scrolled up\n";
break;
case 2:
mouse_event ( GTEvent, pGT_X, pGT_Y, +30, 0); //scrolls up fast
//check cout << "Scrolled fast up\n";
break;
case 3:
mouse_event ( GTEvent, pGT_X, pGT_Y, -10, 0); //scrolls down
//check cout << "Scrolled down\n";
break;
case 4:
mouse_event ( GTEvent, pGT_X, pGT_Y, -30, 0); //scrolls down fast
//check cout << "Scrolled fast down\n";
break;
default:
cout << "ERROR in auto vertical scroll: " << GetLastError () << endl;
break;
}
} //end vertical if
//+ for right scroll; - for left scroll
if ((Activate_Hscroll(pGT_X, pScreen_Res_X, pHscroll_type)) == TRUE)
{
DWORD GTEvent = MOUSEEVENTF_HWHEEL; //set mouse event to horizontal wheel
switch (*pHscroll_type)
{
case 1:
mouse_event ( GTEvent, pGT_X, pGT_Y, +10, 0); //scrolls right
//check cout << "Scrolled right\n";
break;
case 2:
mouse_event ( GTEvent, pGT_X, pGT_Y, +30, 0); //scrolls right fast
//check cout << "Scrolled fast right\n";
break;
case 3:
mouse_event ( GTEvent, pGT_X, pGT_Y, -10, 0); //scrolls left
//check cout << "Scrolled left\n";
break;
case 4:
mouse_event ( GTEvent, pGT_X, pGT_Y, -30, 0); //scrolls left fast
//check cout << "Scrolled fast left\n";
break;
default:
cout << "ERROR in auto Horizontal scroll: " << GetLastError () << endl;
break;
}
} //end horizontal if
//check cout << "**************************************************************************\n\n"; //print to specify this function has come to an end
return;
}
|