How to Attach a process programmatically RRS feed

  • Question

  • Hi,

    I need to attach a process by using vb.net code. Help me out with the code to attach a process.

    Wednesday, November 14, 2018 2:39 PM

All replies

  • Can you specify what process you want to attach to.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, November 14, 2018 2:42 PM
  • It is done with DebugActiveProcess

      <DllImport("Kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
        Public Shared Function DebugActiveProcess(dwProcessId As Integer) As Boolean
        End Function

    (you must compile in x64 for a 64-bit process like Notepad on Windows 10)

    But it is weird to do that in VB.NET...

    Wednesday, November 14, 2018 2:58 PM