BallonTip auf notifyIcon

Trivalik

Mitglied
Um ein BallonTip zu erzeugt braucht man API, das ist ja net das prob die kann man hier nachlesen http://msdn.microsoft.com/library/d...nce/editcontrolmessages/em_showballoontip.asp und habe noch ne static class

Code:
using System;
using System.Runtime.InteropServices;
namespace Microsoft.Win32
{
 public static class BallonTipp
 {
  private const int EM_SHOWBALLOONTIP = 0x1503;
  [DllImport("User32", SetLastError = true)]
  public static extern int SendMessage(
   IntPtr hWnd,
   int Msg,
   int wParam,
   IntPtr lParam);
  [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
  public struct EDITBALLOONTIP
  {
   public int cbStruct;
   public string pszTitle;
   public string pszText;
   public int ttiIcon;
  }
  public enum ttiIcon : int //noch probieren
  {
   TTI_NONE,
   TTI_INFO,
   TTI_WARNING,
   TTI_ERROR
  }
  public static int ShowBallonTip(System.IntPtr Handle,string text, string title, ttiIcon icon)
  {
   EDITBALLOONTIP ballon = new EDITBALLOONTIP();
   ballon.cbStruct = Marshal.SizeOf(ballon);
   ballon.pszText = text;
   ballon.pszTitle = title;
   balloniIcon = (int)icon;
   IntPtr ptrStruct = Marshal.AllocHGlobal(Marshal.SizeOf(ballon));
   Marshal.StructureToPtr(ballon, ptrStruct, true);
   int ret = SendMessage(Handle,EM_SHOWBALLOONTIP,0, ptrStruct);
   Marshal.FreeHGlobal(ptrStruct);
   return ret;
  }
 }
}

auf eine Textbox funktioniert das ja auch, nur auf ein notifyicon? da hier kein handle existiert bzw nur für das icon und das geht in dem fall ja net, das fürs icon ist kein control.
 
Meine ersten Versuche (3 Stunden) brachten kein erfolg. Ich benutze zwar Framework 2.0 werd es heute nachmittag nochmal mit 1.0 Versuchen.
 

Neue Beiträge

Zurück