Exemplo n.º 1
0
        public static void ShowHelp(Control control, string message)
        {
            HH_POPUP popup = new HH_POPUP(Marshal.StringToCoTaskMemUni(message));

            try
            {
                if (GetCursorPos(out popup.pt))
                {
                    RECT      WindowBounds;
                    HandleRef Parent = new HandleRef(control, control.Handle);

                    if (GetWindowRect(Parent, out WindowBounds))
                    {
                        if (!WindowBounds.Contains(popup.pt))
                        {
#warning TODO: proper alignment if partially off the screen

                            popup.pt.X = WindowBounds.Left + ((WindowBounds.Right - WindowBounds.Left) >> 1);
                            popup.pt.Y = WindowBounds.Top + ((WindowBounds.Bottom - WindowBounds.Top) >> 1);
                        }

                        HtmlHelpW(Parent, IntPtr.Zero, HH_DISPLAY_TEXT_POPUP, ref popup); // file parameter must be null
                    }
                }
            }
            finally
            {
                Marshal.FreeCoTaskMem(popup.pszText);
            }
        }
Exemplo n.º 2
0
 private static extern IntPtr HtmlHelpW(HandleRef control, IntPtr file, uint command, [In] ref HH_POPUP popup);