Results 1 to 5 of 5

Thread: uncapture a window

  1. #1
    Chinese Leper
    Guest

    Question uncapture a window

    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)?

  2. #2
    jim mcnamara
    Guest
    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.

  3. #3
    Chinese Leper
    Guest
    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?

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Destroy the Window in your Form Unload event
    VB Code:
    1. Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
    2. Private Declare Function IsWindowEnabled Lib "user32" (ByVal hwnd As Long) As Long
    3. 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
    4. Private Sub Form_Load()
    5.     'KPD-Team 2001
    6.     'URL: [url]http://www.allapi.net/[/url]
    7.     'E-Mail: [email][email protected][/email]
    8.     Dim bl As Boolean
    9.     'Is the window enabled?
    10.     bl = IsWindowEnabled(Me.hwnd)
    11.     MsgBox "Is the form enabled? " + Str$(bl)
    12.     'Move the window
    13.     MoveWindow Me.hwnd, 0, 0, 200, 200, 1
    14.     'Show the window
    15.     Me.Show
    16.     'Wait 5 seconds
    17.     t = Timer
    18.     Do
    19.         'Show the remaining time in the form's caption
    20.         Me.Caption = 5 - Int(Timer - t)
    21.         DoEvents
    22.     Loop Until Timer > t + 5
    23.     'Destroy the window
    24.     DestroyWindow Me.hwnd
    25. End Sub

  5. #5
    Chinese Leper
    Guest
    but i want to keep that captured window alive when i close my program. it usally becomes invisible when i close my program.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width