Results 1 to 5 of 5

Thread: AlwaysOnTop

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    Slovenia
    Posts
    32
    How do I make my app AlwaysOnTop?
    Its easy to do it in Delphi but in VB I can't find anything to do this.
    Thanx in advance for any reply.

    Celery
    VB6 Pro SP3 - Academic Licence

  2. #2
    New Member
    Join Date
    Jul 2000
    Posts
    4
    Not hard, this one:

    Add the following to a module:

    Code:
    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
    
    Global Const SWP_NOMOVE = 2
    Global Const SWP_NOSIZE = 1
    Global Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
    Global Const HWND_TOPMOST = -1
    Global Const HWND_NOTOPMOST = -2
    Then add this to the Form_Load of the form you want on top (make sure you replace FORM1 with the form's name):

    Code:
    res& = SetWindowPos(FORM1.hwnd, HWND_TOPMOST, _
    0, 0, 0, 0, FLAGS)
    Failing that, there are a few good AOT controls around.

    Hope this helps...
    from Starsky
    VB6 Pro SP3
    I'm not stupid, I just don't post a lot. No, really...

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    Slovenia
    Posts
    32

    Angry

    Thanx for your reply Starsky!
    But Delphi still has much easier way to do that - you just
    set FormStyle to StayOnTop. I can't understand why VB can't
    copy some things from Delphi (and vice versa). Programming
    would be much easier for everyone!

    Celery
    VB6 Pro SP3 - Academic Licence

  4. #4
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    are you serious? Delphi had the OnTop feature?
    NXSupport - Your one-stop source for computer help

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    Slovenia
    Posts
    32
    Yeah!
    I had Delphi 3 and it was very easy to switch from AlwaysOnTop to Normal form style in
    design- and runtime.
    I really miss that in VB!

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