Results 1 to 4 of 4

Thread: Program On Top

Hybrid View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Posts
    65

    Post

    Does Anyone Have A Code To Keep Your Program On Top? I Mean So That When They Switch Windows Your Program Is Still In Say One Corner Or Where Ever They Left It???

    Also How Would You Get An App To Search a Text File For A Certain Field It Is Looking For, As In Only Add The Text From Certain Place In The Text File???


    Also How Do You Get An App To Search Your Hardrive For A Certain File?


  2. #2
    New Member
    Join Date
    Dec 1999
    Posts
    8

    Post

    Use the following code in the form.

    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 Const SWP_NOMOVE = 2
    Private Const SWP_NOSIZE = 1
    Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
    Private Const HWND_TOPMOST = -1
    Private Const HWND_NOTOPMOST = -2

    Private Sub Form_Load()
    SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS
    End Sub

  3. #3
    Hyperactive Member onerrorgoto's Avatar
    Join Date
    Aug 1999
    Location
    Sweden
    Posts
    330

    Post

    If you would search this UBB you would have found this answer. http://www.vb-world.net/ubb/Forum1/HTML/010710.html
    Serge's code give you a property, MakeOnTop, that you can set and then you don't have to mess around with SetWindowsPos.
    But it uses the same code as aditya has written

    ------------------
    On Error Goto Bed :0)
    [email protected]




    [This message has been edited by onerrorgoto (edited 12-01-1999).]

  4. #4
    Lively Member
    Join Date
    Nov 1999
    Posts
    98

    Post

    you could also do this...a little easier than serge's code and no messing with SetWindowPos

    Code:
    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 Const SWP_NOMOVE = 2
    Private Const SWP_NOSIZE = 1
    Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
    Private Const HWND_TOPMOST = -1
    Private Const HWND_NOTOPMOST = -2
      
    Private Function MakeOnTop(frm as Form)
         SetWindowPos frm.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS
    End Function
      
    Private Sub Form_Load()
         MakeOnTop Me
    End Sub
    --michael

    [This message has been edited by funkheads (edited 12-01-1999).]

    [This message has been edited by funkheads (edited 12-01-1999).]

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