示例#1
0
        /// <summary>
        /// This function opens an MHL feature driver for use.
        /// Call this function to select which MHL driver you wish the object instance to use, if you have not already done so in the constructor.
        /// Once a MHL feature driver has been opened you can call the Get/Set functions to communicate / command the driver.
        /// See the specific drivers documentation for information about available functionality.
        ///
        /// If this instance of object have already open MHL driver, it will be internally closed first.
        /// </summary>
        /// <param name="name">Name of the MHL driver to open.</param>
        /// <exception cref="System.ArgumentException">If exceptions are enabled, on failure exception is thrown with valid error message.</exception>
        /// <returns>true on success, false on failure.</returns>
        /// <remarks>On failure, use GetLastError() ot GetLastErrorMessage() for more information.</remarks>
        public bool Open(string name)
        {
            if (this.IsOpen())
            {
                this.Close();
            }
            loadedDrvHandle = MHLSRV._MHL_OpenDrv(name);

            if (throwsException && loadedDrvHandle == WIN32.INVALID_HANDLE_VALUE)
            {
                throw new System.ArgumentException("Cannot open driver " + name, "Error " + this.GetLastError().ToString() + "; " + this.GetLastErrorMessage());
            }

            if (this.IsOpen())
            {
                loadedDrvName = name;
                return(true);
            }
            return(false);
        }
示例#2
0
 /// <summary>PROVIDED ONLY FOR BACKWARD COMPATIBILITY. Please use new HotkeyHelper class.</summary>
 /// <remarks>PROVIDED ONLY FOR BACKWARD COMPATIBILITY. Please use new MHLDriver class.</remarks>
 public int OpenDrv(String name)
 {
     return(MHLSRV._MHL_OpenDrv(name));
 }