...........................................................................................................................................................
................................................. I'm writing a .dll with Visual C++ 2005 .................................................
............................................................................................................................................................
I'm trying to get my .dll to send a single mouseclick to the below coordinates when conditionY is met in functionX().
The following code is similar to example code I found on this forum. It DOES compile but DOESN'T work.
Function X mysteriously returns a value of "-48" constantly. Also: NO MOUSECLICK occurs.
Plz bear with me if I'm not even close here...I'm pretty new at coding (example: do the #include files need to be included in the .h file, or only in the .ccp file ??).
Halp Please!!! Thank you!!!

This is the .h file:
CODE
#include <windows.h>
#include <winable.h>
int left_click()
{
// left mouse button down
INPUT Input={0};
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
::SendInput(1,&Input,sizeof(INPUT));
// left mouse button up
::ZeroMemory(&Input,sizeof(INPUT));
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
::SendInput(1,&Input,sizeof(INPUT));
return (-1);
}
This is the code in the .cpp:
CODE
#include <windows.h>
#include <winuser.h>
#include "mouseclick.h"
int mouseclick()
{
mouse_event(MOUSEEVENTF_LEFTDOWN, 2857, 213, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP,2857,213,0,0);
return 0;
}
int functionX()
{
return(
conditionY==1 ? mouseclick(): 0);
}
This post has been edited by C. Demming: 20 May, 2008 - 01:36 PM