共用方式為


IVsUIShell4.SetupToolbar3(IVsWindowFrame, IVsToolWindowToolbarHost) Method

Definition

Creates a tool bar and also allows routing of commands placed on the toolbar to a specific command target.

public:
 int SetupToolbar3(Microsoft::VisualStudio::Shell::Interop::IVsWindowFrame ^ pFrame, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsToolWindowToolbarHost ^ % pptwth);
public:
 int SetupToolbar3(Microsoft::VisualStudio::Shell::Interop::IVsWindowFrame ^ pFrame, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsToolWindowToolbarHost ^ &  pptwth);
int SetupToolbar3(Microsoft::VisualStudio::Shell::Interop::IVsWindowFrame const & pFrame, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsToolWindowToolbarHost const & & pptwth);
public int SetupToolbar3 (Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame pFrame, out Microsoft.VisualStudio.Shell.Interop.IVsToolWindowToolbarHost pptwth);
abstract member SetupToolbar3 : Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame * IVsToolWindowToolbarHost -> int
Public Function SetupToolbar3 (pFrame As IVsWindowFrame, ByRef pptwth As IVsToolWindowToolbarHost) As Integer

Parameters

pFrame
IVsWindowFrame

[in] The window frame for the new toolbar.

pptwth
IVsToolWindowToolbarHost

[out] Location to return the tool bar hosting interface.

Returns

Returns S_OK if the tool bar was set up.

Remarks

This version of the SetupToolbar() method is designed to be used directly with IVsWindowFrame instances. In the new WPF windowing system it is much more convenient to use the IVsWindowFrame interface instead of trying to get the HWND of window. If the IVsWindowFrame object supports the IOleCommandTarget interface, then it will be used as the target for the commands that appear on the toolbars, otherwise the shell's global command target will be used.

Applies to