Results 1 to 3 of 3

Thread: How do I keep a form showing at all times

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Location
    Wellsburg, WV, USA
    Posts
    25

    Post

    Hi,

    Does anyone know how to keep a form showing at all times above another form. I need to be able to work on the bottom form while the other is above it.

    I need to have something sort of like a legend key that is always there. My problem with the .show command is that if I use vbModal, I cannot click on the form below the top one. If I don't use vbModal, when I click the bottom form, the top form disappears under the bottom one.

    Any help would be greatly appreciated.

    Thanks,
    dmuir

  2. #2
    Junior Member
    Join Date
    Dec 1999
    Location
    houston,tx
    Posts
    20

    Post

    Dear DMuir:

    Put in a module file (.bas) the commands:

    Public Const HWND_TOPMOST = -1
    Public Const HWND_NOTOPMOST = -2
    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

    'then, out in the program, to keep Form1 on top, use the command

    Form1.Show
    success% = SetWindowPos(Form1.hWnd, HWND_TOPMOST, 0, 0, 0, 0, flags)


    'to prevent Form1 from being on top use
    unload Form1

    success% = SetWindowPos(Form1.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, flags)


    That should work,

    Good luck!

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Location
    Wellsburg, WV, USA
    Posts
    25

    Post

    Thanks, leif-p

    It worked. That is just what I needed.

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