private void buttonShare_Click(object sender, EventArgs e) { Vidyo32.VidyoClientRequestGetAlarms Alarm = new Vidyo32.VidyoClientRequestGetAlarms(); int szAlarm = Marshal.SizeOf(Alarm); IntPtr ptrAlarm = Marshal.AllocCoTaskMem(szAlarm); Marshal.StructureToPtr(Alarm, ptrAlarm, true); uint errAlarm = Vidyo32.VidyoClientSendRequest(Vidyo32.VidyoClientRequest.VIDYO_CLIENT_REQUEST_GET_ALARMS, ptrAlarm, szAlarm); if (errAlarm == 0) { Vidyo32.VidyoClientRequestGetAlarms CurrentAlarm = (Vidyo32.VidyoClientRequestGetAlarms)Marshal.PtrToStructure(ptrAlarm, typeof(Vidyo32.VidyoClientRequestGetAlarms)); } Vidyo32.VidyoClientRequestGetWindowsAndDesktops shares = new Vidyo32.VidyoClientRequestGetWindowsAndDesktops(); shares.Init(); int szShares = Marshal.SizeOf(shares); IntPtr ptrShares = Marshal.AllocCoTaskMem(szShares); Marshal.StructureToPtr(shares, ptrShares, true); uint error = Vidyo32.VidyoClientSendRequest(Vidyo32.VidyoClientRequest.VIDYO_CLIENT_REQUEST_GET_WINDOWS_AND_DESKTOPS, ptrShares, szShares); if (error != 0) { return; } Vidyo32.VidyoClientRequestGetWindowsAndDesktops currentShares = (Vidyo32.VidyoClientRequestGetWindowsAndDesktops)Marshal.PtrToStructure(ptrShares, typeof(Vidyo32.VidyoClientRequestGetWindowsAndDesktops)); if (currentShares.numSystemDesktops > 0) { // string firstDesktopId = Marshal.PtrToStringAuto(currentShares.sysDesktopId[0]); string firstDesktopId = currentShares.sysDesktopId[0]; Vidyo32.VidyoClientInEventShare sharePara = new Vidyo32.VidyoClientInEventShare(); sharePara.shareType = Vidyo32.VidyoClientContentsShareType.VIDYO_CLIENT_CONTENTS_SHARE_TYPE_DESKTOP_WINDOW; sharePara.window = (IntPtr)1; sharePara.desktopId = firstDesktopId; int sizeOfShareEvent = Marshal.SizeOf(sharePara); IntPtr sharePtr = Marshal.AllocCoTaskMem(sizeOfShareEvent); Marshal.StructureToPtr(sharePara, sharePtr, false); Int32 returnValue = Vidyo32.VidyoClientSendEvent(Vidyo32.VidyoClientInEvent.VIDYO_CLIENT_IN_EVENT_SHARE, sharePtr, sizeOfShareEvent); return; } }
private void buttonShareWnd_Click(object sender, EventArgs e) { Vidyo32.VidyoClientRequestGetWindowsAndDesktops shares = new Vidyo32.VidyoClientRequestGetWindowsAndDesktops(); shares.Init(); int szShares = Marshal.SizeOf(shares); IntPtr ptrShares = Marshal.AllocCoTaskMem(szShares); Marshal.StructureToPtr(shares, ptrShares, true); int szShares2 = Marshal.SizeOf(ptrShares); uint error = Vidyo32.VidyoClientSendRequest(Vidyo32.VidyoClientRequest.VIDYO_CLIENT_REQUEST_GET_WINDOWS_AND_DESKTOPS, ptrShares, szShares); if (error != 0) { return; } Vidyo32.VidyoClientRequestGetWindowsAndDesktops currentShares = (Vidyo32.VidyoClientRequestGetWindowsAndDesktops)Marshal.PtrToStructure(ptrShares, typeof(Vidyo32.VidyoClientRequestGetWindowsAndDesktops)); if (currentShares.numApplicationWindows <= m_indexWindow) { m_indexWindow = 0; } if (currentShares.numApplicationWindows > m_indexWindow) { Vidyo32.VidyoClientInEventShare sharePara = new Vidyo32.VidyoClientInEventShare(); sharePara.shareType = Vidyo32.VidyoClientContentsShareType.VIDYO_CLIENT_CONTENTS_SHARE_TYPE_APPLICATION_WINDOW; sharePara.window = (IntPtr)currentShares.appWindowId[m_indexWindow++]; int sizeOfShareEvent = Marshal.SizeOf(sharePara); IntPtr sharePtr = Marshal.AllocCoTaskMem(sizeOfShareEvent); Marshal.StructureToPtr(sharePara, sharePtr, false); Int32 returnValue = Vidyo32.VidyoClientSendEvent(Vidyo32.VidyoClientInEvent.VIDYO_CLIENT_IN_EVENT_SHARE, sharePtr, sizeOfShareEvent); return; } }
private void buttonStart_Click(object sender, EventArgs e) { try { //specifying the video handler location Rectangle rect = new Rectangle(0, 0, pnlVideoArea.Width, pnlVideoArea.Height); int szRect = Marshal.SizeOf(rect); IntPtr ptrRect = Marshal.AllocCoTaskMem(szRect); Marshal.StructureToPtr(rect, ptrRect, true); //Specifying logging information Vidyo32.VidyoClientLogParams logParams = new Vidyo32.VidyoClientLogParams(); logParams.logSize = 500000; //log path must exist before running (this is done by Visual Studio build steps here) logParams.setpathToLogDir(".\\logs\\"); logParams.setlogBaseFileName("VidyoSampleApplication"); logParams.setLogLevelsAndCategories("warning all@App all@AppEvents all@LmiApp"); logParams.setPathToDumpDir(".\\logs\\"); int szLog = Marshal.SizeOf(logParams); IntPtr ptrLog = Marshal.AllocCoTaskMem(szLog); Marshal.StructureToPtr(logParams, ptrLog, true); Vidyo32.VidyoClientProfileParams profileParams = new Vidyo32.VidyoClientProfileParams(); //this is where in the registry settings get stored betweeen runs. Empty value defaults to VidyoDesktop's location and settings (but also reuses VidyoDesktop EID) profileParams.setCONFIG_KEY_PATH(""); profileParams.setMYDOCS_DIR(""); profileParams.portNumber = 65000; //VidyoDesktop uses 63457 profileParams.setPRODUCT_NAME("VidyoSampleApplication"); profileParams.setPROGFILES_DIR(""); profileParams.setVIDYO_DIR(""); //this is where the CA base certificate is read from - here we're using Vidyo Desktop's version. profileParams.setCERT_FILE_DIR(".\\"); profileParams.setINSTALLED_APP_DIR(".\\"); int szProfile = Marshal.SizeOf(profileParams); IntPtr ptrProfile = Marshal.AllocCoTaskMem(szProfile); Marshal.StructureToPtr(profileParams, ptrProfile, true); //Starting the client Int32 startRes = Vidyo32.VidyoClientStart(m_myDelegate, // callback IntPtr.Zero, // data ptr ptrLog, //logParams, pnlVideoArea.Handle, ptrRect, // Initial RECT IntPtr.Zero, //reserved ptrProfile, //profileParams, false); //reserved SetFlag(cVcStarted); //Enable window share feature Vidyo32.VidyoClientRequestEnableAppShare enableShare = new Vidyo32.VidyoClientRequestEnableAppShare(); enableShare.isEnable = Vidyo32.VIDYO_TRUE; int nEnableSize = Marshal.SizeOf(enableShare); IntPtr ptrEnableShares = Marshal.AllocCoTaskMem(nEnableSize); Marshal.StructureToPtr(enableShare, ptrEnableShares, true); int szShares2 = Marshal.SizeOf(ptrEnableShares); uint error = Vidyo32.VidyoClientSendRequest(Vidyo32.VidyoClientRequest.VIDYO_CLIENT_REQUEST_ENABLE_APP_SHARE, ptrEnableShares, nEnableSize); if (error != 0) { return; } Vidyo32.VidyoClientRequestConfiguration config = new Vidyo32.VidyoClientRequestConfiguration(); int nconfigSize = Marshal.SizeOf(config); IntPtr ptrConfig = Marshal.AllocCoTaskMem(nconfigSize); Marshal.StructureToPtr(config, ptrConfig, true); int nconfigSize2 = Marshal.SizeOf(ptrConfig); uint error2 = Vidyo32.VidyoClientSendRequest(Vidyo32.VidyoClientRequest.VIDYO_CLIENT_REQUEST_GET_CONFIGURATION, ptrConfig, nconfigSize); if (error2 != 0) { return; } } catch (Exception ex) { } }