在 VB.NET 中 SetWindowPos 应如何使用?

我感觉我写的这段代码没有问题...
2025-04-14 21:15:07
推荐回答(1个)
回答1:

因为数据类型的不同,VB.NET调用系统API函数和VB6不太一样,VB6是这样:

Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

在VB.NET中是这样调用:

 _
Public Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As SetWindowPosFlags) As Boolean
End Function

参考:http://www.pinvoke.net/default.aspx/user32/SetWindowPos.html