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

Thread: ontop

  1. #1
    Join Date
    Jan 2000
    Location
    sweden
    Posts
    22

    ontop

    hello!!
    how can my program be always ontop.


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

    Re: ontop

    1) Make 2 command buttons (Command1, Command2)
    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 flags = SWP_NOMOVE Or SWP_NOSIZE
    Const SWP_NOMOVE = 2
    Const SWP_NOSIZE = 1
    Const HWND_TOPMOST = -1
    Const HWND_NOTOPMOST = -2
    private Sub Command1_Click()
    SetWindowPos me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, flags
    End Sub

    private Sub Command2_Click()
    SetWindowPos me.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, flags
    End Sub



    Clicking Command1 will activate "on top"
    Clicking Command2 will remove "on top"


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