I am using these libraries to find a window and set it's handle to a new handle, like a tab in my program. However, I am having a difficult time releasing the program back to the desktop. Once I close my main application, the window that was captured also closes. Could someone give me a hand please? thank you!
The library :
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
Here is how I would capture a running application, like notepad for example into the active tab in my program :
SetParent(FindWindow(vbNullString, "Untitled - Notepad"), TabControl1.SelectedTab.Handle)
This works fine when capturing the window into my tabpage, but how would I remove that window from my tabpage back onto the desktop?