Results 1 to 3 of 3

Thread: Modal VB Forms in MS Access

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Posts
    230
    I have a COTS(Commercial Off The Shelf) appliation that promotes customizability via a VB DLL. The COTS product, which is a MS Access compiled front end, has a button which allows you to launch any VB DLL you want. The problem is that you must use all forms as modal forms. What I want to do is launch the DLL and display a main form (which has to be modal or the app will reject it) which can launch other "child" forms. When I launch the child forms, I want the "parent" form to hide but VB does not allow .HIDE or setting the Visible prop to False. Is there any way around this.


  2. #2
    Guest
    Use the FindWindow and ShowWindow api functions.

    Code:
    Private Declare Function FindWindow Lib "user32.dll" _
    Alias "FindWindowA" (ByVal lpClassName As Any, ByVal _
    lpWindowName As Any) As Long
    
    Declare Function ShowWindow Lib "user32" Alias "ShowWindow" _
     (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    
    Public Const SW_SHOW = 5
    Public Const SW_HIDE = 0
    
    Private Sub Command1_Click()
    hWin = FindWindow(vbNullString, "WindowCaption")
    If hWin <> 0 Then
    sWin = ShowWindow(hWin, SW_HIDE)
    Else
    MsgBox "Window was not found!", 16
    End If
    End Sub

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Posts
    230

    Thumbs up

    Thanks,

    This worked well for hiding the first or any Modal form displayed when a second is shown. A little more detail

    1) Access calls my dll which launches a form which must me modal. Now Access and Form1 is open.

    2)Form1 can be treated as menu/start from which the user always goes back to launch other forms. Form1 also launch a running Status board form of some info that I want up all the time.

    3) Now Access, Form1, and Status board are open. The problem is that now the user needs to perform another action and needs to get back to Form1 but to do this he must close Status board to get to Form1. Or even worse, if he wants to get back to the Access switchboard, he has close all my dll forms.

    Am I trying to do to much here with an off the shelf product. Is there any way to get around the vendors requirement that all my forms have to be modal to be shown within his Access front end or is it inherent to dll's that they remain on top.

    a2427

    2)

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