예제 #1
0
파일: Dde.cs 프로젝트: mo5h/omeo
        /// <summary>
        /// Initiates a conversation.
        /// </summary>
        /// <param name="service">Service (or application name) we're connecting to.</param>
        /// <param name="topic">Topic to request the server for.</param>
        internal DdeConversation(Dde dde, string service, string topic)
        {
            _dde = dde;

            /*
             * // Describe the conversation
             * Dde.CONVCONTEXT cc;
             * cc.cb = (uint)Marshal.SizeOf(typeof(Dde.CONVCONTEXT));
             * cc.wFlags = 0u;
             * cc.wCountryID = 0u;
             * cc.iCodePage = Win32Declarations.CP_WINANSI;
             * cc.dwLangID = 0u;
             * cc.dwSecurity = 0u;
             * cc.qos.Length = (uint)Marshal.SizeOf(typeof(Dde.SECURITY_QUALITY_OF_SERVICE));
             * cc.qos.ImpersonationLevel = Dde.SECURITY_IMPERSONATION_LEVEL.SecurityAnonymous;
             * cc.qos.ContextTrackingMode = Dde.SECURITY_CONTEXT_TRACKING_MODE.SECURITY_STATIC_TRACKING;
             * cc.qos.EffectiveOnly = 1;
             */

            using (DdeString dsService = new DdeString(_dde, service))
                using (DdeString dsTopic = new DdeString(_dde, topic))
                    _handle = Dde.DdeConnect(_dde.Instance, dsService.Handle, dsTopic.Handle, IntPtr.Zero);

            if (_handle == IntPtr.Zero)
            {
                throw new DdeException("Could not start the DDE conversation.", _dde.GetLastError());
            }
        }