Jump to content

Winactivate does not work after start a specific application


Recommended Posts

I have made a simple program wich is start in a Terminal Server Session.

This program executes 2 applications on start up. This works fine.

Second if the user wants to start Microsoft Word they could press the Word button.

The only problem i got is when the application FysioRoadmap is started the buttons does not work anymore. So if i want to start Microsoft Word and press the button nothing work.

But if i close the FysioRoadmap application the buttons does work.

Is there something wrong in my code?

I think this is code is so simple i can not do anything wrong but i need to be sure.

Maybe there is an other way to activate the application?

The Terminal Server Session will not start an explorer shell only this program wich is set in the Enviroment tab in Active Directory. (for the people who wants to know more)

This is my code:

#include <GUIConstants.au3>
$MainWindow = GUICreate ("Test", 227, 68,@DesktopWidth-235,@DesktopHeight-75,BitOR($WS_POPUP,$WS_DLGFRAME))
WinSetOnTop("Test", "", 1)

Opt("WinTitleMatchMode", 2)
; *************************************************************************************
;                                     BACKGROUND
; *************************************************************************************
GUISetBkColor (0xFFFFFF)

; *************************************************************************************
;                                     CODE
; *************************************************************************************
Run("D:\appdata\Intramed\intramed.exe", "D:\appdata\Intramed\")
Run("D:\appdata\MRS Software\FysioRoadmap\FysioRoadmap.exe", "D:\appdata\MRS Software\FysioRoadmap\")

$word=GUICtrlCreateButton ("Microsoft Word", 10,10,48,48, $BS_ICON)
GUICtrlSetImage (-1, "Word.ico")

$Intramed=GUICtrlCreateButton ("Intramed", 75,10,48,48, $BS_ICON)
GUICtrlSetImage (-1, "Intramed.ico")

$FysioRoadMap=GUICtrlCreateButton ("FysioRoadmap", 140,10,48,48, $BS_ICON)
GUICtrlSetImage (-1, "Fysioroadmap.ico")

$Exit = GUICtrlCreateButton ("Exit", 200,5,17,17, $BS_ICON)
GUICtrlSetImage (-1, "Exit.ico", "", 0)

GuiSetState()

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $word
        If WinExists("Microsoft Word") Then
            WinActivate("Microsoft Word", "")
        Else
            Run("C:\Program Files\Microsoft Office\Office10\WINWORD.EXE", "C:\Program Files\Microsoft Office\Office10")
        EndIf
    
    Case $msg = $Intramed
        If WinExists("Intramed") Then
            WinActivate("Intramed", "")
        Else
            Run("D:\appdata\Intramed\intramed.exe", "D:\appdata\Intramed\")
        EndIf
                        
        Case $msg = $FysioRoadMap
        If WinExists("FysioRoadmap") Then
            WinActivate("FysioRoadmap", "")
        Else
            Run("D:\appdata\MRS Software\FysioRoadmap\FysioRoadmap.exe", "D:\appdata\MRS Software\FysioRoadmap\")
        EndIf
    
        Case $msg = $Exit
        Exit
EndSelect
Wend
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...