Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


[Help] Embed exe to vb.net project filter_list
Author
Message
[Help] Embed exe to vb.net project #1
Hi
How are you?

are i can embed OpenVPN.exe to my project

Reply

RE: [Help] Embed exe to vb.net project #2
"are I can"? I'll assume English isn't your native language, but getting to the point you can embed it as a resource. I just don't know why you'd want to do that, because it's kind of silly. In addition to the output binary size multiplying, you'll have to also embed all required dll's and such (if any), and if you choose to run it, you'll have to extract it all to the locations that they are expected to be in, before you can run it, along with Registry entries perhaps as well too (if any).
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: [Help] Embed exe to vb.net project #3
You can embed any other process by changing the ParentHandle from the process to something like picturebox1 (that is in your form).

imports:
Code:
Imports System.Diagnostics
Imports System.Text
Imports System.Runtime.InteropServices
incorporate user32.dll functions
Code:
Private Declare Function SetParent Lib "user32" (ByVal hwndChild As IntPtr, ByVal hwndNewParent As IntPtr) As Integer
Private Declare Function ShowWindow Lib "user32" (ByVal handle As IntPtr, ByVal nCmdShow As Integer) As Integer


notepad example: (the principle is the same for all GUIs)
Code:
Private Sub run_notepad()
    Dim notepad As New Process
    notepad.StartInfo.FileName = "notepad.exe"
    notepad.Start()
    Do Until notepad.WaitForInputIdle = True
        Application.DoEvents()
    Loop
    embed("notepad")
End Sub
    
Private Sub embed(byval processname as string)
    For Each p As Process In Process.GetProcesses()
        If (p.ProcessName.Contains(processname)) Then
            Dim handle As IntPtr = p.MainWindowHandle
            SetParent(handle, PictureBox1.Handle)
            ShowWindow(handle, 3) ' maximize the exe to dock it. (and remove borders)
        End If
    Next
End Sub

Reply

RE: [Help] Embed exe to vb.net project #4
You can embed any other process by changing the ParentHandle from the process to something like picturebox1 (that is in your form).

imports:
Code:
Imports System.Diagnostics
Imports System.Text
Imports System.Runtime.InteropServices
incorporate user32.dll functions
Code:
Private Declare Function SetParent Lib "user32" (ByVal hwndChild As IntPtr, ByVal hwndNewParent As IntPtr) As Integer
Private Declare Function ShowWindow Lib "user32" (ByVal handle As IntPtr, ByVal nCmdShow As Integer) As Integer


notepad example: (the principle is the same for all GUIs)
Code:
Private Sub run_notepad()
    Dim notepad As New Process
    notepad.StartInfo.FileName = "notepad.exe"
    notepad.Start()
    Do Until notepad.WaitForInputIdle = True
        Application.DoEvents()
    Loop
    embed("notepad")
End Sub
    
Private Sub embed(byval processname as string)
    For Each p As Process In Process.GetProcesses()
        If (p.ProcessName.Contains(processname)) Then
            Dim handle As IntPtr = p.MainWindowHandle
            SetParent(handle, PictureBox1.Handle)
            ShowWindow(handle, 3) ' maximize the exe to dock it. (and remove borders)
        End If
    Next
End Sub

Reply







Users browsing this thread: 1 Guest(s)