Results 1 to 6 of 6

Thread: Those disappearing forms

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    72
    I have a main form
    It has several menus that open other forms.
    Now if I open form1 and then click back on the main form to open form2, Form1 hides behind the main form.

    How do I keep form1 in front of main form and allow form2 to be on top of both.
    Basically like the desktop. Main form is the new desktop
    VB 6 Professional Edition

  2. #2
    Guest
    Try this:

    Code:
    'Main Form
    Form1.Show vbModal
    
    'Form1
    
    Private Sub Command1_Click()
    Form2.Show vbModal
    End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    72
    that only allows you to open one form.
    I need to be able to open several forms

    is there an API call?
    VB 6 Professional Edition

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I see the problem, you want to have the main form as the foreground form, by that you said you clicked on it, but still have the other forms above, you may have to set them on top?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    72
    Kedaman,

    how is that accomplished?
    VB 6 Professional Edition

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    For code in 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
    Const SWP_NOMOVE = 2
    Const SWP_NOSIZE = 1
    Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
    Const HWND_TOPMOST = -1
    Const HWND_NOTOPMOST = -2
    And to set any window, on top you pass it's handle, that is the hwnd property on a form:
    Code:
    SetWindowPos Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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