Supplying Start-Up Information

In addition to requesting notification, a designer can specify an executable program that the host should run or a URL to which it should navigate when it enters run mode. To use this feature in your designer, implement the GetStartupInfo method and set the DESIGNERFEATURE_STARTUPINFO flag in the registry.

GetStartupInfo is defined as follows:

HRESULT GetStartupInfo(DESIGNERSTARTUPINFO *pStartupInfo);

The pStartupInfo parameter points to a structure containing information about the program or URL. The structure is defined as follows:

typedef struct tagDESIGNERSTARTUPINFO
{
    ULONG cb;
    DWORD dwStartupFlags;
    BSTR  bstrStartupData;
} DESIGNERSTARTUPINFO;

The dwStartupFlags member specifies either DESIGNERSTARTUPINFO_EXE or DESIGNERSTARTUPINFO_URL, indicating whether bstrStartupData denotes an executable program or a URL. The cb member specifies the size of the structure; it must be sizeof (DESIGNERSTARTUPINFO).

The following example shows how a designer might implement GetStartupInfo to pass a URL:

HRESULT CMyDesigner::GetStartupInfo
(
    DESIGNERSTARTUPINFO* pStartupInfo   // [in] Startup information
)
{
  pStartupInfo->bstrStartupData = SysAllocString(bstrStartupURL);
  pStartupInfo->dwStartupFlags = DESIGNERSTARTUPINFO_URL;
  pStartupInfo->cb = sizeof(DESIGNERSTARTUPINFO);
  return S_OK;
}

In the example, the designer calls SysAllocString to allocate memory for bstrStartupData. It sets DESIGNERSTARTUPINFO_URL in dwStartupFlags to indicate that the string specifies a URL and sets cb to the length of the structure.

The host is responsible for freeing bstrStartupData.