嵌入式下VB.NET窗体操作 DLL

SetwindowPos returns a Boolean value. Also under VB.NET a Long value is 64 bits and not 32 which was the case in prevIoUs versions of VB. This is why you are getting an exception. In VB.NET Integer is 32 bits,Short is 16 and Byte is 8.
Also check that all the constants you are passing to SetwindowPos are Integers and not Long values.

I'm also assuming you're trying to initiate fullscreen mode. To do this use the following code (includes p/invoke deFinitions) :

Imports System.Runtime.InteropServices

<DllImport ("coredll .dll",EntryPoint:="SetForegroundWindow",SetLastError:=True)> _
Private Function SetForegroundWindow( _
ByVal hwnd As IntPtr) As Boolean
End Function

<DllImport ("coredll .dll",EntryPoint:="SetwindowPos ",SetLastError:=True)> _
Private 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 Integer) As Boolean
End Function

<DllImport ("aygshell.dll",EntryPoint:="SHFullScreen",SetLastError:=True)> _
Private Function SHFullScreen( _
ByVal hwndRequester As IntPtr,_
ByVal dwState As Integer) As Boolean
End Function

Private Const SHFS_HIDETASKBAR As Integer = &H2
Private Const SWP_NOZORDER As Integer = &H4

SetForegroundWindow(hwnd)
SHFullScreen(hwnd,SHFS_HIDETASKBAR)
SetwindowPos (hwnd,IntPtr.Zero,Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height,SWP_NOZORDER)

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...