Position and Resize the main window. Standard UI

I directly used the windows user32 library in order to position the main window in C#

[DllImport(“user32.dll”, SetLastError = true)]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

    [DllImport("user32.dll", SetLastError = true)]
    internal static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);

    [DllImport("user32.dll")]
    internal static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
    internal static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
    const UInt32 SWP_NOSIZE = 0x0001;
    const UInt32 SWP_NOMOVE = 0x0002;
    const UInt32 SWP_SHOWWINDOW = 0x0040;

public ValueType handlerfirstViewZoom = new HWNDDotNet();
public ValueType handlersecondViewZoom = new HWNDDotNet();

var a1 = ZOOM_SDK_DOTNET_WRAP.CZoomSDKeDotNetWrap.Instance.GetMeetingServiceWrap();
var controla = a1.GetUIController();

var errWindow = controla.GetMeetingUIWnd(ref handlerfirstViewZoom, ref handlersecondViewZoom);
if (errWindow == SDKError.SDKERR_SUCCESS)
{

}

// To position the main window side by side with my form.
// Do it in the Move and ResizeEnd events of the form.

if (((HWNDDotNet)handlerfirstViewZoom).value != 0)
{
MoveWindow((IntPtr)(((HWNDDotNet)handlerfirstViewZoom).value), 0, this.Top, this.Left + 9, this.Height, true);
}

//

1 Like