背景:使用C#操縱鼠標(biāo)進(jìn)行重復(fù)性的工作
background: using Csharp to handle the keyboard or mouse to do the repetitive work.
問題:屬性“DllImport”在該聲明類型中無效。它只在“method”聲明中有效。錯(cuò)誤 1 屬性“DllImport”在該聲明類
Question:attribution “DllImport” is invalid in the declaration, it is just valid in the “method” declaration
解決方案:使用外部調(diào)用的方法
Solution:Use the external method
code example:
private static extern int mouse_event( int dwFlags,// 下表中標(biāo)志之一或它們的組合 int dx, int dy, //指定x,y方向的絕對(duì)位置或相對(duì)位置 int cButtons,//沒有使用 int dwExtraInfo//沒有使用 );
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 should declard as static.
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注