Results 1 to 2 of 2

Thread: Activating window

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Location
    London, UK
    Posts
    145
    I wonder about activating windows...(daa?)

    When I run my program and make another one active, I want it to - after a short period of time - become active again. I.e. not having to use Alt+Tab or similar.

    Is there a command or a property for this?
    Cheers, Pentax
    Wilhelm Tunemyr,
    Swede in London

    [email protected]

    "Dort, wo man Bücher verbrennt, verbrennt man am Ende auch Menschen"
    Heinrich Heine (1797-1856)

    Pravda vítezi!
    (Truth prevails!)

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    You could add a timer to your form, set the interval to the number of milliseconds you want between each check and use this code:

    Code:
    Option Explicit
    Private Declare Function GetForegroundWindow Lib "user32" () As Long
    
    Private Sub Timer1_Timer()
        If GetForegroundWindow <> Me.hWnd Then
            AppActivate Me.Caption
        End If
    End Sub

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