No announcement yet.

Embed StreetDeck in Another Application

  • Filter
  • Time
  • Show
Clear All
new posts

  • Embed StreetDeck in Another Application

    The following tutorial discusses how to embed StreetDeck into another application. It applies only to version of StreetDeck and later.

    About Embedding StreetDeck
    There are certain times where only a subset of the functionality of StreetDeck is needed and the rest of the functionality is already provided by another application. In these cases, it may make sense to make StreetDeck a part of that other application by embedding the main StreetDeck window as a child window into that other application and then loading the StreetDeck automation interface to control it through COM.

    How to Embed StreetDeck
    There are two steps that must be taken to use StreetDeck inside of another application. The first is to startup StreetDeck inside the main window of another application. To do this, StreetDeck has a -embed command line parameter that allows the host program to specify the startup location, startup size, and class name and/or window name of the host window to make StreetDeck a child window of.

    Only the location value is required for the -embed command, the size and class or window name values are optional, however, order is important. i.e. The class name and window name, must always be the fifth and sixth parameters of the embed command. Also, if the window or class name includes spaces, you must put quotes around the entire embed parameter list, not just the individual name strings.

    The following example will start StreetDeck embedded in the window with the title StreetDeck Parent Window, at the position 10, 20 with a window size of 320x240 pixels.

    StreetDeck.exe -embed:"10,20,320,240,MFCClass,StreetDeck Parent Window"

    After you have started StreetDeck, if the parent application needs to interact with StreetDeck in any way, it must connect to the StreetDeck out of process COM server by instantiating a COM client that will connect to the StreetDeck application object (StreetDeck.StreetDeckApp). Note that there can only ever be one instance of StreetDeck running so the COM client will always connect to the one and only one instance of StreetDeck, if there is not currently an instance running, this will startup StreetDeck, which is undesirable to us since it is not include the embed parameters and not embed in a host window so it is always important that we start StreetDeck prior to attempting to connect to the StreetDeck application object.

    Most programming languages support COM in some way to allow you to connect to StreetDeck. The following are examples of instantiating a StreetDeck application object.
    VB Script Example:
    Set o = CreateObject("StreetDeck.StreetDeckApp")

    C# Example:
    StreetDeck.StreetDeckApp app;
    app = new StreetDeck.StreetDeckAppClass();

    C++ Example
    IDualStreetDeckApp* pApp;
    HRESULT hr = CoCreateInstance(CLSID_StreetDeckApp, NULL, CLSCTX_LOCAL_SERVER, IID_IDualStreetDeckApp, (LPVOID*)&pApp);

    Example Projects

    C# Example Project