Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            FileStream stream = null;

            try
            {
                stream = new FileStream("lock.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
            }
            catch
            {
                System.Diagnostics.Process.GetCurrentProcess().Kill();
            }

            SHCreateShortcut(@"\Windows\StartUp\rhoconnect-push-service.lnk", "\"" + "Program Files\\rhoconnect-push-service\\rhoconnect-push.exe" + "\"");

            IntPtr _connectionHandle = IntPtr.Zero;
            Guid   networkGuid       = Guid.Empty;

            try
            {
                ConnMgrStatus status = ConnMgrStatus.Unknown;
                ConnMgrMapURL("http://www.google.com", ref networkGuid, 0);
                ConnMgrConnectionInfo info = new ConnMgrConnectionInfo(networkGuid, ConnMgrPriority.HighPriorityBackground);
                ConnMgrEstablishConnectionSync(info, ref _connectionHandle, uint.Parse(Properties.Resources.HttpRetryDelay), ref status);
            }
            catch {}

            Application.Instance.Start();
            if (stream != null)
            {
                stream.Close();
            }

            try
            {
                ConnMgrReleaseConnection(_connectionHandle, 1);
            }
            catch { }
        }
Exemplo n.º 2
0
 static extern int ConnMgrEstablishConnectionSync(ConnMgrConnectionInfo connectionInfo, ref IntPtr connectionHandle, uint dwTimeout, ref ConnMgrStatus dwStatus);
Exemplo n.º 3
0
 static extern int ConnMgrEstablishConnection(ConnMgrConnectionInfo connectionInfo, ref IntPtr connectionHandle);