The MP3car.com Store The MP3car.com Store    

Go Back   MP3Car.com > MP3Car.com Wiki

Embed StreetDeck in Another Application

From MP3Car.com Wiki

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


[edit] 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.


[edit] 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.

Example:
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);


[edit] Example Projects

C# Example Project


All times are GMT -5. The time now is 12:19 PM.


Sponsored Links
The MP3car.com Store

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Powered by vbWiki Pro 1.3 RC4. Copyright ©2006-2007, NuHit, LLC
Copyright © 1999 - 2008 Mp3Car.com Inc.
Ad Management by RedTyger
Message Board Statistics