嵌入exe程序到当前窗口的全局代码,原封不动的复制进项目,保存时报错:
此主题相关图片如下:2017-11-1.jpg
全局代码:
<DllImport("user32.dll", EntryPoint := "FindWindow")> _
Public Function FindWindow(lpClassName As String, lpWindowName As String) As Integer
End Function
<DllImport("user32.dll", EntryPoint := "SetParent")> _
Public Function SetParent(hWndChild As Integer, hWndNewParent As Integer) As Integer
End Function
Public Declare Function MoveWindow Lib "user32" (ByVal hwnd As Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal bRepaint As Integer) As Integer
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Integer, ByVal lpString As StringBuilder, ByVal cch As Integer) As Integer
Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Integer, ByVal lpString As String) As Integer
Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Integer, ByVal wCmd As Integer) As Integer
Declare Function GetActiveWindow Lib "user32" Alias "GetActiveWindow" () As Integer
Public Declare Function ShowWindow Lib "user32" (ByVal hWnd As Integer, ByVal nCmdShow As Integer) As Integer
Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As EnumWindowsProc, ByVal lParam As Integer) As Integer
Public Delegate Function EnumWindowsProc(ByVal hwnd As Integer, ByVal lParam As Integer) As Boolean
Public Declare Function GetParent Lib "user32" (ByVal hwnd As Integer) As Integer
Public Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Integer
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Integer) As Integer
Public Const WM_CLOSE = &H10
<DllImport("user32.dll", SetLastError:=True)> _
Public Function GetForegroundWindow() As IntPtr
End Function
<DllImport("user32.dll")> _
Public Function GetWindowTextLength(hWnd As Integer) As Integer
End Function
Public Function EnumWindowsProcCallBack(ByVal hwnd As Integer, ByVal lParam As Integer) As Boolean
Return Functions.Execute("EnumWindowsProcCallBack", hwnd, lparam)
End Function
Public Const GW_HWNDFIRST =0
Public Const GW_HWNDLAST = 1
Public Const GW_HWNDNEXT = 2
Public Const GW_HWNDPREV = 3
Public Const GW_OWNER = 4
Public jbs As new List (of String)