[AccessD] Access Form Outside The Application Container - Making It Active Programmatically

A.D.Tejpal adtp at touchtelindia.net
Tue Feb 24 23:26:53 CST 2004


Drew,

    Your demo has been very helpful in finding a solution. Certain peculiarities encountered in the process are mentioned below - in case you could throw some light.

    The objective is to have the access application in standby mode (minimized state), with a timer form active. When certain conditions are met, this form causes another form (meant to convey an Alert) to pop up onto the desktop. This pop-up form is required to have the focus on its OK button so that the user is not compelled to use the mouse for dismissing the form.

    (a) The following code in Timer Form's module achieves the desired results -
        ShowWindow Application.hWndAccessApp, _
                                            SW_SHOWMINIMIZED  ' (A)
        DoCmd.OpenForm "frmAlert", acNormal
        FrmHDL = Forms("frmAlert").hwnd
        ShowWindow FrmHDL, SW_SHOWNORMAL

    (b) However, if the API call at (A) is replaced by the following line, the pop-up form gets displayed without having a focus (adding the statement Forms("frmAlert").SetFocus at the end of (a) does not appear to be effective) -
        DoCmd.RunCommand acCmdAppMinimize
        

    (c) Again, if (A) is retained, but the timer form is sought to be closed  by placing the following line at the very end of (a), the pop-up form appears without focus -
        DoCmd.Close acForm, Me.Name

    I shall be thankful if the reason for behaviour outlined at (b) & (c) above could be explained.

Regards,
A.D.Tejpal
--------------
  ----- Original Message ----- 
  From: DWUTKA at marlow.com 
  To: accessd at databaseadvisors.com 
  Sent: Monday, February 23, 2004 21:27
  Subject: RE: [AccessD] Access Form Outside The Application Container - Making It Active Programmatically


  Try the AlwaysOnTop demo off of my site.  

  Drew (http://www.wolfwares.com)

  -----Original Message-----
  From: accessd-bounces at databaseadvisors.com
  To: Access Developers discussion and problem solving
  Sent: 2/22/04 11:18 PM
  Subject: [AccessD] Access Form Outside The Application Container - Making It
  Active Programmatically

      This relates to a minimized Access 2000 application, where one of
  its forms is made to pop up on the desktop via API calls.

      Though everything proceeds as desired, the pop up form itself does
  not get focus until clicked upon. Following API calls have been tried -
  but no success in setting focus on the form -

      ShowWindow
      BringWindowToTop
      SetForegroundWindow
      SetActiveWindow
  '    SetFocus                     ' Gives Compile Error

      Note - FlashWindow and SetWindowText if tried, do what is expected
  but the focus gets lost eventually
          
      I shall be thankful for any help in this regard.

  Regards,
  A.D.Tejpal
  --------------




More information about the AccessD mailing list