System.Windows.Forms.MessageBoxManager.GetDlgCtrlID C# (CSharp) Method

GetDlgCtrlID() private method

private GetDlgCtrlID ( IntPtr hwndCtl ) : int
hwndCtl IntPtr
return int
        private static extern int GetDlgCtrlID(IntPtr hwndCtl);

Usage Example

Example #1
0
        private static bool MessageBoxEnumProc(IntPtr hWnd, IntPtr lParam)
        {
            StringBuilder stringBuilder = new StringBuilder(10);

            MessageBoxManager.GetClassName(hWnd, stringBuilder, stringBuilder.Capacity);
            if (stringBuilder.ToString() == "Button")
            {
                switch (MessageBoxManager.GetDlgCtrlID(hWnd))
                {
                case 1:
                    MessageBoxManager.SetWindowText(hWnd, MessageBoxManager.OK);
                    break;

                case 2:
                    MessageBoxManager.SetWindowText(hWnd, MessageBoxManager.Cancel);
                    break;

                case 3:
                    MessageBoxManager.SetWindowText(hWnd, MessageBoxManager.Abort);
                    break;

                case 4:
                    MessageBoxManager.SetWindowText(hWnd, MessageBoxManager.Retry);
                    break;

                case 5:
                    MessageBoxManager.SetWindowText(hWnd, MessageBoxManager.Ignore);
                    break;

                case 6:
                    MessageBoxManager.SetWindowText(hWnd, MessageBoxManager.Yes);
                    break;

                case 7:
                    MessageBoxManager.SetWindowText(hWnd, MessageBoxManager.No);
                    break;
                }
                MessageBoxManager.nButton++;
            }
            return(true);
        }