C#申明API函数

来源:百度知道 编辑:UC知道 时间:2024/07/07 22:13:26
这是VB的API申明

Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

怎么转换成C#的API申明啊?

using System.Runtime.InteropServices;

[DllImport("user32.dll")]
public static extern uint CallWindowProc(uint lpPrevWndFunc, uint hWnd, uint msg, uint wParam, uint lParam);

[DllImport("user32.dll")]
public static extern uint GetWindowLong(uint hWnd, int nIndex);

[DllImport("user32.dll")]
public static extern uint SetWindowLong(uint hWnd, int nIndex, uint dwNewLong);