/// <summary> /// Shows the specified video window in the specified panel. /// </summary> private static void ShowVideo(Panel videoPanel, VideoWindow videoWindow) { //Win32 constants: WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; const long lEnableWindowStyles = 0x40000000L | 0x02000000L | 0x04000000L; //Win32 constants: WS_POPUP| WS_CAPTION | WS_SIZEBOX const long lDisableWindowStyles = 0x80000000 | 0x00C00000 | 0x00040000L; const int OATRUE = -1; try { //sets the properties required for the native video window to draw itself videoWindow.Owner = videoPanel.Handle.ToInt32(); videoWindow.SetWindowPosition(0, 0, videoPanel.Width, videoPanel.Height); //gets the current window style to modify it long currentStyle = videoWindow.WindowStyle; //disables borders, sizebox, close button currentStyle = currentStyle & ~lDisableWindowStyles; //enables styles for a child window currentStyle = currentStyle | lEnableWindowStyles; //updates the current window style videoWindow.WindowStyle = (int)currentStyle; //updates the visibility videoWindow.Visible = OATRUE; } catch (Exception exception) { Console.WriteLine(exception); } }
private void SetWindowPosition(VideoWindow videoWindow) { var point = new Point(0, 0); var size = new Size(VideoWidth, VideoHeight); if (videoWindow.Height != VideoHeight) { VideoOriginHeight = videoWindow.Height; } if (videoWindow.Width != VideoWidth) { VideoOriginWidth = videoWindow.Width; } videoWindow.SetWindowPosition((int)point.X, (int)point.Y, (int)size.Width, (int)size.Height); if (VideoOriginHeight == 0 || VideoOriginWidth == 0) { } else { var actualHeight = (int)Math.Floor(new decimal((VideoOriginHeight * VideoWidth / VideoOriginWidth))) + 12; size.Height = actualHeight; point.Y = (VideoHeight - actualHeight) / 2; } //videoWindow.SetWindowPosition((int)point.X, (int)point.Y, (int)size.Width, (int)size.Height); }
public void SetWindowPosition(int left, int top, int width, int height) { try { LyncObject.SetWindowPosition(left, top, width, height); } catch (LyncClientException lcex) { if (lcex.InternalCode != 0x80040209) { return; // Just swallow the exception that is caused by accessing the window after the conversation is inactive } throw; } }
/// <summary> /// Shows the specified video window in the specified panel. /// </summary> private static void ShowVideo(IntPtr parentHandle, Rectangle bounds, VideoWindow videoWindow) { //Win32 constants: WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; const long lEnableWindowStyles = 0x40000000L | 0x02000000L | 0x04000000L; //Win32 constants: WS_POPUP| WS_CAPTION | WS_SIZEBOX const long lDisableWindowStyles = 0x80000000 | 0x00C00000 | 0x00040000L; const int OATRUE = -1; try { //sets the properties required for the native video window to draw itself var handle = (IntPtr.Size == 4) ? parentHandle.ToInt32() : parentHandle.ToInt64(); videoWindow.Owner = handle; videoWindow.SetWindowPosition(bounds.X, bounds.Y, bounds.Width, bounds.Height); //gets the current window style to modify it long currentStyle = videoWindow.WindowStyle; //disables borders, sizebox, close button currentStyle = currentStyle & ~lDisableWindowStyles; //enables styles for a child window currentStyle = currentStyle | lEnableWindowStyles; //updates the current window style videoWindow.WindowStyle = (int)currentStyle; //updates the visibility videoWindow.Visible = OATRUE; } catch (Exception exception) { Console.WriteLine(exception); } }