The following VBA code finds the ArcMap Table of Contents dockable window and, if it's currently visible, the TOC is docked on the right side of the application.
[Visual Basic 6.0]
Public Sub DockTOC()
Dim pDocWinMgr As IDockableWindowManager
Dim pTOC As IDockableWindow
Set pDocWinMgr = Application 'QI
Set pTOC = pDocWinMgr.GetDockableWindow(arcid.TableofContents)
If pTOC.IsVisible Then
pTOC.Dock esriDockRight
End If
End Sub
[Visual Basic .NET, C#, C++]
No example is available for Visual Basic .NET, C#, or C++. To view a Visual Basic 6.0 example, click the Language Filter button
in the upper-left corner of the page.