0
I created a dll with a code in C++, when I went to use gave an error.
function within the dll that I tried to use
extern "C" __declspec(dllexport) void ClickLeftMouse(int x, int y){
POINT cursorPos;
cursorPos.x = x;
cursorPos.y = y;
HWND hwnd = FindWindow(0, (LPCWSTR)"PXG Client");
DWORD dw = MAKEWORD(cursorPos.x, cursorPos.y);
SendMessage(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, dw);
SendMessage(hwnd, WM_LBUTTONUP, MK_LBUTTON, dw);}
as I declared the function that is inside the dll, already in the code c#.
[DllImport("MouseEvent.dll")]
public static extern void ClickLeftMouse(int x, int y);
how I call the function
private void checkBox_bother_CheckedChanged(object sender, EventArgs e)
{
ClickLeftMouse(546, 16);
}
When I click to use the function of the following error, someone can help me?
Has this dll been added to your project references? Project Menu > Add Reference...
– Ismael
I just put and keeps giving the same error. I thought I was just putting the dll in the project folder..
– Igor Bittencourt
He must not be recognizing the path. Check out this post Soen http://stackoverflow.com/questions/2864673/specify-the-search-path-for-dllimport-in-net
– Ismael
Also did not give..
– Igor Bittencourt