コード例 #1
0
ファイル: Display.cs プロジェクト: reimashi/nvapi.net
 /// <summary>
 /// This function returns the handle of the NVIDIA unattached display specified by the enum index (thisEnum). The client should keep enumerating until it returns error. Note: Display handles can get invalidated on a modeset, so the calling applications need to renum the handles after every modeset.
 /// </summary>
 /// <param name="thisEnum">The index of the NVIDIA display.</param>
 /// <param name="pNvDispHandle">Pointer to the NVIDIA display handle of the unattached display.</param>
 /// <returns></returns>
 public static Status EnumNvidiaUnAttachedDisplayHandle(int thisEnum, ref UnAttachedDisplayHandle pNvDispHandle)
 {
     Status status;
     if (EnumNvidiaUnAttachedDisplayHandleInternal != null) { status = EnumNvidiaUnAttachedDisplayHandleInternal(thisEnum, ref pNvDispHandle); }
     else { status = Status.NVAPI_FUNCTION_NOT_FOUND; }
     return status;
 }
コード例 #2
0
ファイル: DisplayApi.cs プロジェクト: vanattab/NvAPIWrapper
        /// <summary>
        ///     This function returns the display name given, for example, "\\DISPLAY1", using the unattached NVIDIA display handle
        /// </summary>
        /// <param name="display">Handle of the associated unattached display</param>
        /// <returns>Name of the display</returns>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: Display handle is null.</exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA device maps to that display name.</exception>
        public static string GetUnAttachedAssociatedDisplayName(UnAttachedDisplayHandle display)
        {
            var getUnAttachedAssociatedDisplayName =
                DelegateFactory.Get <Delegates.Display.NvAPI_GetUnAttachedAssociatedDisplayName>();
            ShortString displayName;
            var         status = getUnAttachedAssociatedDisplayName(display, out displayName);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }
            return(displayName.Value);
        }
コード例 #3
0
ファイル: DisplayApi.cs プロジェクト: vanattab/NvAPIWrapper
        /// <summary>
        ///     This function converts the unattached display handle to an active attached display handle.
        ///     At least one GPU must be present in the system and running an NVIDIA display driver.
        /// </summary>
        /// <param name="display">An unattached display handle to convert.</param>
        /// <returns>Display handle of newly created display.</returns>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: Invalid UnAttachedDisplayHandle handle.</exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found</exception>
        public static DisplayHandle CreateDisplayFromUnAttachedDisplay(UnAttachedDisplayHandle display)
        {
            var createDisplayFromUnAttachedDisplay =
                DelegateFactory.Get <Delegates.Display.NvAPI_CreateDisplayFromUnAttachedDisplay>();
            DisplayHandle newDisplay;
            var           status = createDisplayFromUnAttachedDisplay(display, out newDisplay);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }
            return(newDisplay);
        }
コード例 #4
0
        /// <summary>
        ///     This function returns a physical GPU handle associated with the specified unattached display.
        ///     The source GPU is a physical render GPU which renders the frame buffer but may or may not drive the scan out.
        ///     At least one GPU must be present in the system and running an NVIDIA display driver.
        /// </summary>
        /// <param name="display">Display handle to get information about</param>
        /// <returns>Physical GPU handle associated with the specified unattached display.</returns>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: display is not valid</exception>
        /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found</exception>
        public static PhysicalGPUHandle GetPhysicalGPUFromUnAttachedDisplay(UnAttachedDisplayHandle display)
        {
            var status =
                DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GetPhysicalGPUFromUnAttachedDisplay>()(display,
                                                                                                        out var gpu);

            if (status != Status.Ok)
            {
                throw new NVIDIAApiException(status);
            }

            return(gpu);
        }
コード例 #5
0
        /// <summary>
        /// This function returns the handle of the NVIDIA unattached display specified by the enum index (thisEnum). The client should keep enumerating until it returns error. Note: Display handles can get invalidated on a modeset, so the calling applications need to renum the handles after every modeset.
        /// </summary>
        /// <param name="thisEnum">The index of the NVIDIA display.</param>
        /// <param name="pNvDispHandle">Pointer to the NVIDIA display handle of the unattached display.</param>
        /// <returns></returns>
        public static Status EnumNvidiaUnAttachedDisplayHandle(int thisEnum, ref UnAttachedDisplayHandle pNvDispHandle)
        {
            Status status;

            if (EnumNvidiaUnAttachedDisplayHandleInternal != null)
            {
                status = EnumNvidiaUnAttachedDisplayHandleInternal(thisEnum, ref pNvDispHandle);
            }
            else
            {
                status = Status.NVAPI_FUNCTION_NOT_FOUND;
            }
            return(status);
        }
コード例 #6
0
 /// <summary>
 ///     Creates a new UnAttachedDisplay
 /// </summary>
 /// <param name="handle">Handle of the unattached display device</param>
 public UnAttachedDisplay(UnAttachedDisplayHandle handle)
 {
     Handle = handle;
 }
コード例 #7
0
        /// <summary>
        /// This function returns the handle of an unattached NVIDIA display that is associated with the given display name (such as "\\DISPLAY1").
        /// </summary>
        /// <param name="szDisplayName"></param>
        /// <param name="pNvUnAttachedDispHandle"></param>
        /// <returns></returns>
        public static Status GetAssociatedUnAttachedNvidiaDisplayHandle(string szDisplayName, ref UnAttachedDisplayHandle pNvUnAttachedDispHandle)
        {
            StringBuilder builder = new StringBuilder((int)NvShortStringMax);

            builder.Append(szDisplayName);

            Status status;

            if (GetAssociatedUnAttachedNvidiaDisplayHandleInternal != null)
            {
                status = GetAssociatedUnAttachedNvidiaDisplayHandleInternal(builder, ref pNvUnAttachedDispHandle);
            }
            else
            {
                status = Status.NVAPI_FUNCTION_NOT_FOUND;
            }
            szDisplayName = builder.ToString();

            Console.WriteLine(pNvUnAttachedDispHandle.ptr);

            return(status);
        }
コード例 #8
0
ファイル: Display.cs プロジェクト: reimashi/nvapi.net
        /// <summary>
        /// This function returns the handle of an unattached NVIDIA display that is associated with the given display name (such as "\\DISPLAY1").
        /// </summary>
        /// <param name="szDisplayName"></param>
        /// <param name="pNvUnAttachedDispHandle"></param>
        /// <returns></returns>
        public static Status GetAssociatedUnAttachedNvidiaDisplayHandle(string szDisplayName, ref UnAttachedDisplayHandle pNvUnAttachedDispHandle)
        {
            StringBuilder builder = new StringBuilder((int)NvShortStringMax);
            builder.Append(szDisplayName);

            Status status;
            if (GetAssociatedUnAttachedNvidiaDisplayHandleInternal != null) { status = GetAssociatedUnAttachedNvidiaDisplayHandleInternal(builder, ref pNvUnAttachedDispHandle); }
            else { status = Status.NVAPI_FUNCTION_NOT_FOUND; }
            szDisplayName = builder.ToString();

            Console.WriteLine(pNvUnAttachedDispHandle.ptr);

            return status;
        }