i captured a window with setparent into my mdi form. How do i uncapture this window (e.g. remove this window from my mdi form without closing it)? :confused:
Printable View
i captured a window with setparent into my mdi form. How do i uncapture this window (e.g. remove this window from my mdi form without closing it)? :confused:
Use SetParent to 'give' it to another form. You can create a small
.Visible = False form to hold it while you don't want to use it. OR you can park it somewhere else.
the thing is, my program is suppose to capture a a program on startup (i got that part) and uncapture it at end.
So what parent should i set the program to?
Destroy the Window in your Form Unload eventVB Code:
Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function IsWindowEnabled Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long Private Sub Form_Load() 'KPD-Team 2001 'URL: [url]http://www.allapi.net/[/url] 'E-Mail: [email][email protected][/email] Dim bl As Boolean 'Is the window enabled? bl = IsWindowEnabled(Me.hwnd) MsgBox "Is the form enabled? " + Str$(bl) 'Move the window MoveWindow Me.hwnd, 0, 0, 200, 200, 1 'Show the window Me.Show 'Wait 5 seconds t = Timer Do 'Show the remaining time in the form's caption Me.Caption = 5 - Int(Timer - t) DoEvents Loop Until Timer > t + 5 'Destroy the window DestroyWindow Me.hwnd End Sub
but i want to keep that captured window alive when i close my program. it usally becomes invisible when i close my program.