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

前端之家收集整理的这篇文章主要介绍了嵌入式下VB.NET窗体操作 DLL前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

@H_404_1@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 @H_404_1@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:="@H_404_1@SetWindowPos ",SetLastError:=True)> _
Private Function @H_404_1@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)
@H_404_1@SetWindowPos (hwnd,IntPtr.Zero,Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height,SWP_NOZORDER)

原文链接:/vb/262537.html

猜你在找的VB相关文章