Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Mar 2005
    Location
    Salem, Oregon, USA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Shell command opens document underneath (vb 6)

    I use the shell command to open documents or images depending on the file type. The problem is that some of the documents open underneath the application, and others open on top. If the file is an image, or text document, it opens on top, but a word document will open below the app, so you do not know it is there. Is there a setting or switch that I should be using to make the shell open on top? Here is the code:

    Private Function ShellOpen(ByVal hwnd As Long, ByVal sFileName As String, Optional ByVal eWindowStyle As ShowWindowConstants = SW_SHOWNORMAL) As Boolean
    ' open a document as if the user clicked on it in explorer
    Dim lRv As Long

    ShellOpen = False

    lRv = ShellExecute(hwnd, "Open", sFileName, "", "", eWindowStyle)

    If lRv >= 32 Then ShellOpen = True
    End Function


    Thanks, Chris

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Shell command opens document underneath (vb 6)

    If you're using Windows XP, it probably has to do with the "Prevent applications from stealing focus" setting. Since this is a per-user setting, there is not much you can do about it.

  3. #3
    New Lounger
    Join Date
    Mar 2005
    Location
    Salem, Oregon, USA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Shell command opens document underneath (vb 6)

    Thanks Hans,

    I tried to switch the registry and that did not work. I also downloaded tweak ui to do the same thing, but did not help either. My process works for most file types except word and excel. I think that I will just live with this for now.

    Chris

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •