CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2012
    Posts
    5

    How do you bring a window to the front

    How do you bring a vb6 window to the front of all other program windows that are open eg IE, Word not just the vb6 windows? I have tried Show and SetFocus

    Thanks, Steve

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: How do you bring a window to the front

    Do a quick search for

    VB6 SetTopMost API

    Shoudl give you some matches with sample code.
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: How do you bring a window to the front

    Other APIs to consider would be SetWindowPos and BringWindowToFront

  4. #4
    Join Date
    Sep 2012
    Posts
    7

    Re: How do you bring a window to the front

    If your window does not contain A SetFocus Method you should use win32api

    There are several methods (depending on what you like):

    Private Declare Function BringWindowToTop Lib "user32.dll" (ByVal hwnd As Long) As Long
    Private Declare Function SetFocus Lib "user32.dll" (ByVal hwnd As Long) As Long
    Private Declare Function SetWindowPos Lib "user32.dll" (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
    Private Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

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

Featured