GUI window problem

looking at the GUI templates i can not identify the window. there are only controls defined.

usually i do this

Window = new Form();
Window.FormBorderStyle = FormBorderStyle.None;
Window.StartPosition = FormStartPosition.Manual;
Window.Location = new System.Drawing.Point(0,0);
Window.Size = new System.Drawing.Size(512,512);

in case of the GUI template, what’s the name of the window object ? where is it.

a gui plugin inherits from the .net UserControl class. the window that holds this usercontrol is provided and managed by vvvv.

if you want to provide your own window you do like this:

  • add a references to: Microsoft.VisualStudio.OLE.Interop
  • implement IWin32Window and ICustomQueryInterface

like eg:

using System.Runtime.InteropServices;
using Microsoft.VisualStudio.OLE.Interop;

public IntPtr Handle
{
   get {return FMyUserControl.Handle;}
}
  
public CustomQueryInterfaceResult GetInterface(ref Guid iid, out IntPtr ppv)
{
   if (iid.Equals(Guid.Parse("00000112-0000-0000-c000-000000000046")))
   {
      ppv = Marshal.GetComInterfaceForObject(FMyUserControl, typeof(IOleObject));
      return CustomQueryInterfaceResult.Handled;
   }
   else if (iid.Equals(Guid.Parse("458AB8A2-A1EA-4d7b-8EBE-DEE5D3D9442C")))
   {
      ppv = Marshal.GetComInterfaceForObject(FMyUserControl, typeof(IWin32Window));
      return CustomQueryInterfaceResult.Handled;
   }
   else
   {
      FLogger.Log(LogType.Debug, "missing: " + iid.ToString());
      ppv = IntPtr.Zero;
      return CustomQueryInterfaceResult.NotHandled;
   }
}

thank you, this looks unfamiliar. any reason why i never came across this when building winforms with sharpdevelop. just curious why vvvv handles winforms this way.

would be nice to have some control over the window without providing my own window.

well, unfamiliar it may be. but it is the way to go if you need your own window for a vvvv plugin.

it is by design that vvvv provides window-handling for gui-plugins. so by default you get known vvvv-window-behavior. if you want to work around that you have to do as lined out above.

otherwise you can take control over a window by sending patch-messages…