How to open an .EXE file window from Codesys

leandroct
2019-02-05
2024-04-18
  • leandroct - 2019-02-05

    I want to open an executable file via Codesys (3.5 SP13). I installed the SysOS23 library (3.5.13.0) in my Codesys ControlWin program. I have tried all the instructions available in this library, and all instructions open the program, but without opening the program window. That is, only in Task Manager you can see that the program has been opened.

    I tried to open the .EXE file using the "ExecutePlcProgram" in a Button, but it had the same behaviour.
    I tried to embed the EXE file in the program without success too.

    How do I make the application window to open?

    PROGRAM POU
    VAR
    CRODA: BOOL;
    Result: DINT;
    Teste2: UDINT;
    Resultado: POINTER TO UDINT;
    END_VAR

    IF CRODA THEN
    Result := (pszCommand:= 'C:\Windows\Notepad.exe');
    Teste2 :=
    (pszComand:= 'C:\Windows\Notepad.exe', pResult:= Resultado);
    SysCreateProcess(pszCommandLine:= 'C:\Windows\Notepad.exe', bHide:= FALSE);
    SysCreateProcess(pszCommandLine:= 'C:\Windows\Notepad.exe', bHide:= TRUE);
    CRODA := FALSE;
    END_IF

    IMG: Task Manager.png

     
    • fedu - 2022-06-10

      Did you solve this problem?
      I have too now

       
      • dFx

        dFx - 2022-06-13

        If you want to show a program window, you first have to check which is the user starting the program. Because the interface you see here, is for a user and only this one. Althougt that a user may not have an interface at all (system accounts for instance).
        So I would look at how to start your program with the proper user first.

         
        • fedu - 2022-06-16

          Thanks for your replay, but I'm sorry I didn't understand.
          My windows user name is Administrator.
          My codesys user has to be Administrator too?

           
        • fedu - 2022-06-16

          Thanks for your replay, but I'm sorry I didn't understand.
          My windows user name is Administrator.
          My codesys user has to be Administrator too?

           
    • fedu - 2022-06-10

      Did you solve this problem?
      I have too now

       
  • kumareasu - 2024-04-18

    Have you solved this ?

     

Log in to post a comment.