Technical divergence: information prompting in MSN using APIs in Delphi

Source: Internet
Author: User
Technical Splitting: Using APIs in Delphi to prompt information in MSN: Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiNetwork/html/delphi_20061211171215149.html
I prefer to use MSN, because its information prompts are quite unique. All chat software pops up a common Windows dialog box, but it seems to come out of the taskbar. Think about it. Adding an API to a pure OOP tool like Delphi should not be difficult to implement. It took 10 minutes to finally come up. The following is the implementation method:

1. Create an APPLICATION and place the two buttons in the main form FROM1, which are button1 and button2.

Button1.caption: = 'Open Window ′;
Button2.caption: = 'Close Window ′;

2. Add the form form2 in new in the file menu, and set form2 to Available froms in options in the project.

3. The following are the controls and attribute settings in the FORM2 form.

Form2.borderstyle: = bsNone;

Add panel1

Panel1.align: = alclient;
Panel1.bevellnner: = bvLowered;

You can add the text you want in panel1.

OK. Open the FORM2 code window. The Code is as follows:

Unit Unit2;

Interface

Uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, jpeg, StdCtrls;

Type
TForm2 = class (TForm)
Panel1: TPanel;
Image1: TImage;
Label1: TLabel;
Procedure Label1Click (Sender: TObject );
Procedure Image1Click (Sender: TObject );
Private
{Private declarations}
Public
Procedure Show;
Procedure close;
{Public declarations}
End;

Var
Form2: TForm2;

Implementation
Procedure tform2.close;
Begin
If AnimateWindow (Handle, 200, AW_VER_POSITIVE + AW_HIDE) = false then
Begin
Showmessage ('form exit error ′);
Free;
End;
Inherited close;
End;
Procedure tform2.Show;
Begin
Top: = 430;
Left: = 560;
If AnimateWindow (Handle, 200, AW_VER_NEGATIVE) = false then
Begin
Showmessage ('error in form display ′);
Free;
End;
Inherited show;
End;
{$ R *. dfm}

The above red area shows the code for implementing special effects. Add the following code to FORM1:

Unit Unit1;

Interface

Uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

Type
TForm1 = class (TForm)
Button1: TButton;
Button2: TButton;
Procedure Button1Click (Sender: TObject );
Procedure Button2Click (Sender: TObject );
Private
{Private declarations}
Public
{Public declarations}
End;

Var
Form1: TForm1;

Implementation

Uses Unit2;
Var
Mesfrm: tform2;
{$ R *. dfm}

Procedure TForm1.Button1Click (Sender: TObject );
Begin
Mesfrm: = tform2.Create (application );
Mesfrm. Show;
End;

Procedure TForm1.Button2Click (Sender: TObject );
Begin
Mesfrm. close;
End;

End.

OK, you can see the effect by running the program, but remember to set the display to 800*600 pixels.

Because the production time is short, only the basic effect is achieved, but a slight modification can be exactly the same as the message prompt of MSN.

Ding

Bench first ~~~~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.