CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Always on top

  1. #1
    Join Date
    May 1999
    Location
    Memphis
    Posts
    24

    Always on top

    Is there a way to make a vb app always stay on top, regardless of the active window. An example would be the task manager window.




  2. #2
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: Always on top

    make a command button and place this code into form:
    private Declare Function SetWindowPos Lib "user32" (byval h%, byval hb%, byval X%, byval Y%, byval cx%, byval cy%, byval F%) as Integer

    Const SWP_NOMOVE = 2
    Const SWP_NOSIZE = 1
    Const flags = SWP_NOMOVE Or SWP_NOSIZE
    Const HWND_TOPMOST = -1


    private Sub Command1_Click()
    SetWindowPos me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, flags

    End Sub




    Good luck!


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

Featured