Results 1 to 3 of 3

Thread: How to make my app stay always "active"???

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    47
    Hi!

    Is there any way to make my vb6 application to stay always fake-active (not always on top)...I mean the window looks like it would be active (coloured titlebar) but other programs work normally, like my app wouldn't always be active....


    RubbeBubbe

  2. #2
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    Hello again, just to straighten this out, are you aware of
    the API and how to implement it? If you are not then check
    out the tutorials on the main page of this site to get you
    familiar with it. Anyways, to answer your question, place
    this code in the Form that you want to always be "in focus"
    (known as being always on top, or as the top-most window):
    Code:
    'Place these in the General Declarations section of your Form.
    Private Const HWND_TOPMOST As Long = -1
    Private Const SWP_NOSIZE As Long = &H1
    Private Const SWP_NOMOVE As Long = &H2
    
    Private Declare Function SetWindowPos _
                    Lib "user32" _
                    (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
                    ByVal x As Long, ByVal y As Long, _
                    ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    
    Private Sub Form_Load()
       'This API call makes your App to be the top-most Window.
       Call SetWindowPos(Form1.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE)
    End Sub
    Dan PM
    Analyst Programmer

    VB6 SP3 (also VB4 16-bit sometimes )

  3. #3
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    363
    Anyone know how to keep your titlebar colored to appear to have focus even when it doesn't? This is something I need also. SonGouki's code keeps your window on top but that doesn't sound quite like what lkivik was looking for.
    Wade

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