Results 1 to 4 of 4

Thread: Bring a window to top??

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    74

    Bring a window to top??

    How do i bring a window (e.g from IE) to the top? I tried it like this
    Code:
    windowhandle = FindWindow(vbNullString, "Mywebsite - Microsoft Internet Explorer")
    If windowhandle <> 0 Then
         BringWindowToTop windowhandle 
         DoEvents
         SetForegroundWindow windowhandle 
    End If
    but it does not work properly. Sometimes the window comes to top, the other time the window is blinking in the taskbar, but it remains in background.

  2. #2
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    Did you try the inhernet Appactivate method?

    VB Code:
    1. strTitle = "VB Q and A - General VB Questions - Microsoft Internet Explorer"
    2. AppActivate strTitle

    "Brothers, you asked for it."
    ...Francisco Domingo Carlos Andres Sebastian D'Anconia

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    74
    Yes, didn't work either..

  4. #4
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    try this instead
    VB Code:
    1. Private Declare Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Long
    2. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    3.  
    4. Private Sub Command1_Click()
    5. strtitle = "VB Q and A - General VB Questions - Microsoft Internet Explorer"
    6. ret = FindWindow(vbNullString, strtitle)
    7. BringWindowToTop ret
    8. End Sub

    "Brothers, you asked for it."
    ...Francisco Domingo Carlos Andres Sebastian D'Anconia

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