Results 1 to 5 of 5

Thread: Setting the foreground window

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Hamilton, New Zealand
    Posts
    137
    I have an app that is accessing Microsoft Access (no pun intended) and displaying a report.

    I want MS Access to bring itself to the front so that the report is immediately visible instead of my application.

    I have tried using the following API's
    SendMessage WM_SETFOCUS
    SetForegroundWindow
    BringWindowToTop
    SetWindowPos

    all with no success, they will select the Applications button on the taskbar but the actual window is not displayed on the screen, it stays minimised.

    Does anybody know a way to make access pop up showing the report, This is quite an important problem for me to solve as some of my reports show forms from inside access to query the user for more information and if the user does not respond to these forms in access my program sits there as if it has hung when really it is just waiting for access to return from displaying the report.

    Any help would be much appreciated
    Regards

    Matt Brown
    Hamilton, NZ
    VB6 C++ in Visual Studio 6sp4
    VB.net Beta 1

  2. #2
    Hyperactive Member wasiq's Avatar
    Join Date
    Jan 2000
    Location
    Karachi, Sindh, Pakistan
    Posts
    274
    Try using this
    Code:
    Declare Function SetActiveWindow Lib "user32.dll" (ByVal hwnd As Long) As Long

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Hamilton, New Zealand
    Posts
    137
    That doesn't work

    It works even less well that SetForegroundWindow

    With SetForegroundWindow the button on the taskbar receives the focus but the window is not restored or maximised.

    The problem is specific to acess if I pass the hwnd of another window to SetForegroundWindow it handles it find and the requested window is brought to the top of the ZOrder.

    So really i am needing a work around to compensate for Access!
    Regards

    Matt Brown
    Hamilton, NZ
    VB6 C++ in Visual Studio 6sp4
    VB.net Beta 1

  4. #4
    Guest
    Have you tried the ShowWindow API function?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Hamilton, New Zealand
    Posts
    137
    Works perfectly thanks
    Regards

    Matt Brown
    Hamilton, NZ
    VB6 C++ in Visual Studio 6sp4
    VB.net Beta 1

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