Notifies the designer that the host's IDE has returned to design mode after being in run mode.
HRESULT AfterRun(
void pvData
);
Parameter
pvData
[in] Pointer to data previously returned by IDesignerDebugging::BeforeRun.
Return Values
The designer returns one of the following values:
Return Value | Meaning |
S_OK | Success. |
Other statuses | Errors. |
Comments
The designer implements this method.
If the designer specifies the DESIGNERFEATURE_NOTIFYAFTERRUN flag in the registry, the host calls the AfterRun method after its IDE leaves run mode and returns to design mode.
If the designer specifies both DESIGNERFEATURE_NOTIFYBEFORERUN and DESIGNERFEATURE_NOTIFYAFTERRUN, the host calls both BeforeRun and AfterRun. Even if the host does not successfully enter run mode, if it has called BeforeRun it will also call AfterRun, so the designer can clean up any state information it has retained.
The format of pvData is designer-specific. The value of the parameter is not available to the run-time instance; it is accessible only to a design-time instance that implements the BeforeRun and AfterRun methods. You can use this parameter to store temporary data across debugging sessions.
The designer must allocate pvData with CoTaskMemAlloc; the host frees it after AfterRun returns. Note, however, that if the pvData structure contains pointers to other dynamically allocated data, the designer is responsible for freeing those nested pointers.
Example
The following example implements the AfterRun method for a designer that saves the name of two temporary files across a debugging session. In the first two lines, the designer uses a local macro to free any existing strings in the global data structure m_rmiRunMode
. Next, if pvData
represents a valid pointer, the example copies the data structure into its own global variable and calls a local routine to delete and rename the files.
STDMETHODIMP MyDesigner::AfterRun(LPVOID pvData)
{
FREESTRING(m_rmiRunMode.bstrRunFile);
FREESTRING(m_rmiRunMode.bstrFileToRename);
if (pvData != NULL){
memcpy(&m_rmiRunMode, pvData, sizeof(RunModeInfo));
}
RemoveTempFile(m_rmiRunMode.bstrRunFile,
m_rmiRunMode.bstrFileToRename);
return S_OK;
}
See Also
IDesignerDebugging::BeforeRun, DESIGNERFEATURE_NOTIFYAFTERRUN