Error when using a c ++ dll in a C #

0

I created a dll with a code in C ++, when I went to use it 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 stated the function that is inside the dll, already in C # code.

[DllImport("MouseEvent.dll")]
public static extern void ClickLeftMouse(int x, int y);

How do 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, can anyone help me?

    
asked by anonymous 25.04.2017 / 20:01

0 answers