none
Shell focus option not working for me RRS feed

  • Question

  • I have an app which has a shell command 'Shell("C:\somewhere\program.exe",1)'

    the problem is that my shelled app does not get focus a defined by",1"

    my app stays on top of the shelled app, how do I get the shelled app to be in focus & my app behind

    Sunday, August 4, 2019 6:42 AM

Answers

  • Worked fine the last 2 days but not today! Also had an issue to run app twice today & second time shelled app did not focus on top of my app.

    Hi,

    try process

     Process.Start

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 12, 2019 3:25 AM
    Moderator

All replies

  • I have an app which has a shell command 'Shell("C:\somewhere\program.exe",1)'

    the problem is that my shelled app does not get focus a defined by",1"

    my app stays on top of the shelled app, how do I get the shelled app to be in focus & my app behind

    Hi

    Try this:

        Dim ProcessID As Integer = Shell("C:\somewhere\program.exe", AppWinStyle.NormalFocus)
    


    Regards Les, Livingston, Scotland

    Sunday, August 4, 2019 10:50 AM
  • Hi,

    1 Window has focus and is restored to its original size and position. This member is equivalent to the Visual Basic constant vbNormalFocus.

    https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.appwinstyle?view=netframework-4.8

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 5, 2019 7:18 AM
    Moderator
  • Thanks Les & Alex for your suggestions for my problem.

    In my environment? only 1 in 10 times has the shelled app had focus. I have changed for the suggestion by Les & today it worked, whether this continues remains to be seen as I only use the app once a day.

    So, will wait & see how it performs over the next few days before posting again

    Tuesday, August 6, 2019 5:01 AM
  • Worked fine the last 2 days but not today! Also had an issue to run app twice today & second time shelled app did not focus on top of my app.
    Friday, August 9, 2019 5:44 AM
  • Worked fine the last 2 days but not today! Also had an issue to run app twice today & second time shelled app did not focus on top of my app.

    Hi,

    try process

     Process.Start

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 12, 2019 3:25 AM
    Moderator
  • I ran my app prior to reading your message & had the same problem, I have changed it to:

    Dim psi As New ProcessStartInfo("C:\somewhere\program.exe")
    Dim proc = Process.Start(psi)

    Last 2 starts of my app have been ok, thanks for your suggestion, will re-post at weekend with progress

    Tuesday, August 13, 2019 5:19 AM
  • As I use this app every day, the latest change seems to be working fine, so thanks to Alex
    Sunday, August 18, 2019 5:39 AM