Click here to Skip to main content
15,887,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I've created a Custom Balloon tool tip using the following API's in C#.

C#
#region Static Extern Methods (API)

        [DllImport("User32", SetLastError = true)]
        internal static extern int GetClientRect(
            int hWnd,
            ref RECT lpRect);

        [DllImport("User32", SetLastError = true)]
        internal static extern int ClientToScreen(
            int hWnd,
            ref POINTAPI lpPoint);

        [DllImport("User32", SetLastError = true)]
        private static extern int ClientToScreen(
            int hWnd,
            ref RECT lpRect);

        [DllImport("User32", SetLastError = true)]
        internal static extern int SendMessage(
            int hWnd,
            int Msg,
            int wParam,
            IntPtr lParam);

        [DllImport("user32.dll", SetLastError = true)]
        internal static extern int SendMessage(
            int hWnd,
            int Msg,
            int wParam,
            int lParam);

        [DllImport("user32.dll", SetLastError = true)]
        internal static extern int SendMessage(
            int hWnd,
            int Msg,
            int wParam,
            TOOLINFO lParam);

        [DllImport("User32", SetLastError = true)]
        internal static extern int CreateWindowEx(
            int dwExStyle,
            string lpClassName,
            string lpWindowName,
            int dwStyle,
            int X,
            int Y,
            int nWidth,
            int nHeight,
            int hWndParent,
            int hMenu,
            int hInstance,
            IntPtr lpParam);

        [DllImport("User32", SetLastError = true)]
        internal static extern int DestroyWindow(int hwnd);

        [DllImport("User32", SetLastError = true)]
        static extern int MoveWindow(
            int hwnd,
            int x,
            int y,
            int nWidth,
            int nHeight,
            int bRepaint);

        #endregion


My Problem is when the form is in minimized state and shown the balloon means. The entire system is hanged.

I found the that problem when calling the "SendMessage(int hWnd,int Msg,int wParam,IntPtr lParam)" Method.

please some one suggesst suggest me to solve this problem.

Thanks & Regards
Dhilip.R
Posted
Updated 1-Apr-22 10:21am
v2
Comments
Sergey Alexandrovich Kryukov 9-Dec-11 0:34am    
The problem is hardly in P/Invoke (why P/Invoke? all tooltip functionality is available in .NET...). It must be in some code you did not show.
--SA
Addy Tas 11-Dec-11 14:19pm    
You do know that sendmessage is a synchronous operation right? If you want to handle it async use the post message call. Next to that... Why P/Invoke?

Cheers, AT

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900