Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

CodeSys HMI, ActiveX, Windows Media Player

2012-11-30
2019-01-23
  • maasdamer88 - 2012-11-30

    I've got a problem with simulation in CodeSys HMI.
    I created an ActiveX component and in order to play a movie I made my own .dll library. It works fine in CodeSys simulation:

    But when I start the program in CodeSys HMI simulation, it doesn't work. The movie isn't loaded:

    Here is the code of dll library:

    // dllmain.cpp : Defines the entry point for the DLL application.
    \#include "stdafx.h"
    \#include <unknwn.h>
    \#include <exdisp.h>
    //#include <wmp.h>
    \#import "wmp.dll" no_namespace named_guids
    BOOL APIENTRY DllMain( HMODULE hModule,
                           DWORD  ul_reason_for_call,
                           LPVOID lpReserved
                    )
    {
       switch (ul_reason_for_call)
       {
       case DLL_PROCESS_ATTACH:
       case DLL_THREAD_ATTACH:
       case DLL_THREAD_DETACH:
       case DLL_PROCESS_DETACH:
          break;
       }
       return TRUE;
    }
    extern "C" __declspec (dllexport) void ExecuteActiveXCall(IUnknown* pUnk, char* pszId, char* pszParam)
    {
       if (strcmp(pszId, "Wideo1") == 0)
       {
          IUnknown* pNewUnk;
          IWMPCore* url;
          BSTR MyBstr = SysAllocString(L"put.wmv");
          pUnk->QueryInterface(IID_IWMPCore, (void**) &pNewUnk);
          url = (IWMPCore*) pNewUnk;
          if (url)
          {
             url->put_URL(MyBstr);
          }
       }
       else if (strcmp(pszId, "Wideo2") == 0)
       {
          IUnknown* pNewUnk;
          IWMPCore* url;
          BSTR MyBstr = SysAllocString(L"funnycats.mp4");
          pUnk->QueryInterface(IID_IWMPCore, (void**) &pNewUnk);
          url = (IWMPCore*) pNewUnk;
          if (url)
          {
             url->put_URL(MyBstr);
          }
       }
    }
    

    Does anybody know how to solve this problem?

    IMG: mov1.png

    IMG: mov2.png

     
  • MusashiAharon - 2012-11-30

    How big are the movies? Is it possible to put them in the PLC's memory and have the PLC webserver provide them?

    Or, is it possible that you are using relative paths and the active directory has changed? Can you try using absolute paths instead?

     
  • maasdamer88 - 2012-12-01

    Zitat:
    How big are the movies? Is it possible to put them in the PLC's memory and have the PLC webserver provide them?

    17MB~ and 4MB~. Yes, it's possible, but Windows CE 5.0 in my EATON XV102 controller doesn't support Windows Media Player so I can't even see a 'window' of WMP in a browser.

    Zitat:
    Or, is it possible that you are using relative paths and the active directory has changed? Can you try using absolute paths instead?

    Hmm, when I changed paths to absolute ones: ```

    BSTR MyBstr = SysAllocString(L"C:\Users\Kamil\Desktop\project1\put.wmv");

    ``` there is no reaction in both simulations.

    And
    ```

    (L"put.wmv")

    ``` means that the movie is inside the directory of the project of course.

    In CoDeSysHMI simulation when I'm clicking the button 'Wideo' it is showing "Multimedia processing.." for 0,5sec(and blinking) and then it is turning to "ready"("ready" means "gotowy" in the screenshot).
    Any other solutions?

     
  • pradeep213 - 2019-01-23

    maasdamer88 hat geschrieben:
    I've got a problem with simulation in CodeSys HMI.
    I created an ActiveX component and in order to play a movie I made my own .dll library. It works fine in CodeSys simulation:
    mov1.png
    But when I start the program in CodeSys HMI simulation, it doesn't work. The movie isn't loaded:
    mov2.png
    Here is the code of dll library:

    // dllmain.cpp : Defines the entry point for the DLL application.
    \#include "stdafx.h"
    \#include <unknwn.h>
    \#include <exdisp.h>
    //#include <wmp.h>
    \#import "wmp.dll" no_namespace named_guids
    BOOL APIENTRY DllMain( HMODULE hModule,
                           DWORD  ul_reason_for_call,
                           LPVOID lpReserved
                    )
    {
       switch (ul_reason_for_call)
       {
       case DLL_PROCESS_ATTACH:
       case DLL_THREAD_ATTACH:
       case DLL_THREAD_DETACH:
       case DLL_PROCESS_DETACH:
          break;
       }
       return TRUE;
    }
    extern "C" __declspec (dllexport) void ExecuteActiveXCall(IUnknown* pUnk, char* pszId, char* pszParam)
    {
       if (strcmp(pszId, "Wideo1") == 0)
       {
          IUnknown* pNewUnk;
          IWMPCore* url;
          BSTR MyBstr = SysAllocString(L"put.wmv");
          pUnk->QueryInterface(IID_IWMPCore, (void**) &pNewUnk);
          url = (IWMPCore*) pNewUnk;
          if (url)
          {
             url->put_URL(MyBstr);
          }
       }
       else if (strcmp(pszId, "Wideo2") == 0)
       {
          IUnknown* pNewUnk;
          IWMPCore* url;
          BSTR MyBstr = SysAllocString(L"funnycats.mp4");
          pUnk->QueryInterface(IID_IWMPCore, (void**) &pNewUnk);
          url = (IWMPCore*) pNewUnk;
          if (url)
          {
             url->put_URL(MyBstr);
          }
       }
    }
    

    Does anybody know how to solve this problem?

     

Log in to post a comment.