So I found the code to place a program inside a VB form here: http://www.vbforums.com/showthread.p...her-container)
The program that I put inside the form is a game called Minecraft. However, when I go to click to enter my password and username at the login screen the cursor in the password/username boxes does not appear. The program inside the form would recognize clicks on things like links and buttons. So I logged in to Minecraft using the offline mode option. To my surprise I could not open my items menu or move my character around (which use keyboard controls). They only thing I could do was change the way he was facing, which uses the mouse and not the keyboards. I am thinking that Visual Basic is hijacking the controls of my keyboard and I'm unsure how to remedy this.
For the SetProcessParent I am using "javaw" Here's the code again, I've changed nothing but the javaw portion. javaw relates to the javaw.exe process that Minecraft is apparently using. I'm a beginner and really don't understand this code very well, so I appreciate any help given.
The program that I put inside the form is a game called Minecraft. However, when I go to click to enter my password and username at the login screen the cursor in the password/username boxes does not appear. The program inside the form would recognize clicks on things like links and buttons. So I logged in to Minecraft using the offline mode option. To my surprise I could not open my items menu or move my character around (which use keyboard controls). They only thing I could do was change the way he was facing, which uses the mouse and not the keyboards. I am thinking that Visual Basic is hijacking the controls of my keyboard and I'm unsure how to remedy this.
For the SetProcessParent I am using "javaw" Here's the code again, I've changed nothing but the javaw portion. javaw relates to the javaw.exe process that Minecraft is apparently using. I'm a beginner and really don't understand this code very well, so I appreciate any help given.
Code:
Imports System.Diagnostics.Process
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Public Class Form1
'Declaring some constants to use with the SendMessage API
Private Const WM_SYSCOMMAND As Integer = 274
Private Const SC_MAXIMIZE As Integer = 61488
'This is the API that does all the hard work
<Runtime.InteropServices.DllImport("user32.dll")> _
Public Shared Function SetParent(ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
End Function
'This is the API used to maximize the window
<Runtime.InteropServices.DllImport("user32.dll")> _
Public Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
End Function
'This is the process that is currently set as a child to the form
Dim parentedProcess As Process
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
'This is important! If you have a child process on your form, it will terminate along with your form if you do not set its parent to Nothing
If Not parentedProcess Is Nothing Then
SetParent(parentedProcess.MainWindowHandle, Nothing)
End If
End Sub
Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Escape Then
End
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SetProcessParent("javaw")
End Sub
Private Sub SetProcessParent(ByVal processName As String)
'Retrieve an array of running processes with the given name
Dim processes() As Process = Process.GetProcessesByName(processName)
If processes.Length = 0 Then
MessageBox.Show("No processes by that name found")
Else
'If there already is a process set as a child to our form, we set its parent to Nothing, to make it go back to its normal state.
If Not parentedProcess Is Nothing Then
SetParent(parentedProcess.MainWindowHandle, Nothing)
End If
'This forms new child will be the process on index 0 of the array
parentedProcess = processes(0)
SetParent(parentedProcess.MainWindowHandle, Me.Handle)
'SetParent(parentedprocess.MainWindowHandle,Me.Panel1.Handle) Try adding a panel to your form and use this line instead of the above line.
'Now lets maximize the window of the process
SendMessage(parentedProcess.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0)
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
End Class