How to display a message window in the right bottom corner of the active display using Delphi

前端 未结 7 1543
青春惊慌失措
青春惊慌失措 2021-02-04 17:29

These days you see a lot of software displaying message windows in the right bottom corner of the active screen for a few seconds or until a close button is cli

相关标签:
7条回答
  • 2021-02-04 17:36

    TMsnPopUpNotify

    http://www.torry.net/vcl/forms/appearence/tmsnpopup.zip

    0 讨论(0)
  • 2021-02-04 17:41

    What you are searching for are Balloon Tips in a System Tray. For general WinAPI here's a nice tutorial for it, that you shouldn't have problems translating to Delphi.

    You can find some ready to use code for balloon tips in Delphi here.

    A nice implementation is available here.

    0 讨论(0)
  • 2021-02-04 17:45
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;
    
    type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure FormCreate(Sender: TObject);
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.FormCreate(Sender: TObject);
      function TaskBarHeight: integer; // this is just to get the taskbar height to put
      // my form in the correct position
      var
        hTB: HWND;
        TBRect: TRect;
      begin
        hTB := FindWindow('Shell_TrayWnd', '');
        if hTB = 0 then
          Result := 0
        else
        begin
          GetWindowRect(hTB, TBRect);
          Result := TBRect.Bottom - TBRect.Top;
        end;
      end;
    
    begin
      Self.Left := Screen.Width - Self.Width;
      Self.Top := Screen.Height-Self.Height-TaskBarHeight;
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      i: integer;
      TimeSleep: integer;
    begin
      TimeSleep := 5; // the speed you want to show/hide.Increase/descrease this to make it faster or slower
      for i := 1 to Self.Height do
      begin
        Self.Top := Self.Top+1;
        Sleep(TimeSleep);
      end;
      // now let's show it again(use this as code as the show code)
      for i := 1 to Self.Height do
      begin
        Self.Top := Self.Top-1;
        Sleep(TimeSleep);
      end;
    end;
    
    end.
    

    via http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_25043483.html

    0 讨论(0)
  • 2021-02-04 17:51

    You can check where is Taskbar:

    uses ShellAPI;
    //...
    Var AppBar: TAppbarData;
    //...
    begin
      FillChar(AppBar, sizeof(AppBar), 0);
      AppBar.cbSize := Sizeof(AppBar);
    
      if ShAppBarMessage(ABM_GETTASKBARPOS, AppBar) <> 0 then
      begin
        //AppBar.rc is TRect
      end;
    end;
    

    And then show your form...

    0 讨论(0)
  • 2021-02-04 17:53

    Check out Snarl, similar to Growl for Windows, but I have found to be better. There is a Pas file to easily interface, and the way it works is very simple, with just sending windows messages.

    http://fullphat.net/

    It also allows the end user some amount of control of which messages to see, duration before fading, etc.

    0 讨论(0)
  • 2021-02-04 17:55

    Try using the TJvDesktopAlert component wich is included in the JVCL, you can find an example in jvcl\examples\JvDesktopAlert\JvDesktopAlertDemo.dpr


    (source: agnisoft.com)

    0 讨论(0)
提交回复
热议问题