C # Problems in referencing ins | Csharp cite the plugin problem,
Background: use C # To manipulate the mouse for repetitive work
Background: using Csharp to handle the keyboard or mouse to do the repetitive work.
Problem: the attribute "DllImport" is invalid in this Declaration type. It is valid only in the "method" declaration. Error 1 attribute "DllImport" in this Declaration class
Question: attribution "DllImport" is invalid in the declaration, it is just valid in the "method" declaration
Solution: use external call Methods
Solution: Use the external method
Code example:
Private static extern int mouse_event (
Int dwFlags, // One of the following table flags or their combination
Int dx,
Int dy, // specifies the absolute or relative position of the x and y directions.
Int cButtons, // not used
Int dwExtraInfo // not used
);
Extern is used to declare the method implemented externally, it is often used in the situation that interop (using System. runtime. interopServices) to call unmanaged code in and DllImport is used at the same time. at that time the method shoshould declard as static.