::: µ¨ÆÄÀÌ Tip&Trick :::

µ¨ÆÄÀÌ Tip&Trick ¼º°Ý¿¡ ¸ÂÁö ¾Ê´Â ±¤°í,ºñ¹æ,Áú¹®ÀÇ ±ÛÀº Áï½Ã »èÁ¦Çϸç
³»¿ëÀ» º¹»çÇÏ¿© »ç¿ëÇÒ °æ¿ì ¹Ýµå½Ã ÀÌ°÷(http://www.howto.pe.kr)À» Ãâó·Î ¸í½ÃÇÏ¿© ÁÖ¼¼¿ä


Category

  ±¸Ã¢¹Î(2003-03-14 12:23:39, Hit : 7371, Vote : 1423
 http://www.delphi.pe.kr
 Æ®·¹ÀÌ ¾ÆÀÌÄÜ¿¡ dz¼± ÈùÆ® º¸¿©ÁÖ±â

[ÆÁ] Æ®·¹ÀÌ ¾ÆÀÌÄÜ¿¡ dz¼± ÈùÆ® º¸¿©ÁÖ±â

//¾È³çÇϼ¼¿ä~ ±¸Ã¢¹ÎÀÔ´Ï´Ù.

//Á¦°¡ Å×½ºÆ® ÇØ º¸¾Ò´Âµ¥ Á¤¸» ½Ó¹ÚÇÏ°Ô Ç³¼±ÈùÆ®°¡ ¸¸µé¾î Áý´Ï´Ù.

//¾Æ¸¶ ¸¸Á·(?) ÇϽǰ̴ϴÙ. ¤»¤»

//±×·³~ Áñ°Å¿î ÇÁ·Î±×·¡¹Ö ÇϽñæ~~


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

{new constant definitions}

const
  NIF_INFO = $10;
  NIF_MESSAGE = 1;
  NIF_ICON = 2;
  NOTIFYICON_VERSION = 3;
  NIF_TIP = 4;
  NIM_SETVERSION = $00000004;
  NIM_SETFOCUS = $00000003;
  NIIF_INFO = $00000001;
  NIIF_WARNING = $00000002;
  NIIF_ERROR = $00000003;

  NIN_BALLOONSHOW = WM_USER + 2;
  NIN_BALLOONHIDE = WM_USER + 3;
  NIN_BALLOONTIMEOUT = WM_USER + 4;
  NIN_BALLOONUSERCLICK = WM_USER + 5;
  NIN_SELECT = WM_USER + 0;
  NINF_KEY = $1;
  NIN_KEYSELECT = NIN_SELECT or NINF_KEY;
  
  NIN_BALLOONSHOW = WM_USER + 2;
  NIN_BALLOONHIDE = WM_USER + 3;
  NIN_BALLOONTIMEOUT = WM_USER + 4;
  NIN_BALLOONUSERCLICK = WM_USER + 5;
  NIN_SELECT = WM_USER + 0;
  NINF_KEY = $1;
  NIN_KEYSELECT = NIN_SELECT or NINF_KEY;
  {other constants can be found in vs.net---vc7's dir: PlatformSDKIncludeShellAPI.h}

  {define the callback message}
  TRAY_CALLBACK = WM_USER + $7258;

  {new NotifyIconData structure definition}
type
  PNewNotifyIconData = ^TNewNotifyIconData;
  TDUMMYUNIONNAME    = record
    case Integer of
      0: (uTimeout: UINT);
      1: (uVersion: UINT);
  end;

  TNewNotifyIconData = record
    cbSize: DWORD;
    Wnd: HWND;
    uID: UINT;
    uFlags: UINT;
    uCallbackMessage: UINT;
    hIcon: HICON;
   //Version 5.0 is 128 chars, old ver is 64 chars
    szTip: array [0..127] of Char;
    dwState: DWORD; //Version 5.0
    dwStateMask: DWORD; //Version 5.0
    szInfo: array [0..255] of Char; //Version 5.0
    DUMMYUNIONNAME: TDUMMYUNIONNAME;
    szInfoTitle: array [0..63] of Char; //Version 5.0
    dwInfoFlags: DWORD;   //Version 5.0
  end;


type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    IconData: TNewNotifyIconData;
    procedure SysTrayIconMsgHandler(var Msg: TMessage); message TRAY_CALLBACK;
    procedure AddSysTrayIcon;
    procedure ShowBalloonTips;
    procedure DeleteSysTrayIcon;
  public
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

uses
  ShellAPI;

procedure TForm1.SysTrayIconMsgHandler(var Msg: TMessage);
begin
  case Msg.lParam of
    WM_MOUSEMOVE:;
    WM_LBUTTONDOWN:;
    WM_LBUTTONUP:;
    WM_LBUTTONDBLCLK:;
    WM_RBUTTONDOWN:;
    WM_RBUTTONUP:;
    WM_RBUTTONDBLCLK:;
    //followed by the new messages
    NIN_BALLOONSHOW:
    {Sent when the balloon is shown}
      ShowMessage('NIN_BALLOONSHOW');
    NIN_BALLOONHIDE:
    {Sent when the balloon disappears?Rwhen the icon is deleted,
    for example. This message is not sent if the balloon is dismissed because of
    a timeout or mouse click by the user. }
      ShowMessage('NIN_BALLOONHIDE');
    NIN_BALLOONTIMEOUT:
    {Sent when the balloon is dismissed because of a timeout.}
      ShowMessage('NIN_BALLOONTIMEOUT');
    NIN_BALLOONUSERCLICK:
    {Sent when the balloon is dismissed because the user clicked the mouse.
    Note: in XP there's Close button on he balloon tips, when click the button,
    send NIN_BALLOONTIMEOUT message actually.}
      ShowMessage('NIN_BALLOONUSERCLICK');
  end;
end;

  {AddSysTrayIcon procedure add an icon to notification area}
procedure TForm1.AddSysTrayIcon;
begin
  IconData.cbSize := SizeOf(IconData);
  IconData.Wnd := AllocateHWnd(SysTrayIconMsgHandler);
  {SysTrayIconMsgHandler is then callback message' handler}
  IconData.uID := 0;
  IconData.uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
  IconData.uCallbackMessage := TRAY_CALLBACK;   //user defined callback message
  IconData.hIcon := Application.Icon.Handle;    //an Icon's Handle
  IconData.szTip := 'Please send me email.';
  if not Shell_NotifyIcon(NIM_ADD, @IconData) then
    ShowMessage('add fail');
end;

{ShowBalloonTips procedure carry out the new feature: Balloon Tips}
procedure TForm1.ShowBalloonTips;
var
  TipInfo, TipTitle: string;
begin
  IconData.cbSize := SizeOf(IconData);
  IconData.uFlags := NIF_INFO;
  TipInfo := 'Please send me email.';
  strPLCopy(IconData.szInfo, TipInfo, SizeOf(IconData.szInfo) - 1);
  IconData.DUMMYUNIONNAME.uTimeout := 3000;
  TipTitle := 'Happyjoe@21cn.com';
  strPLCopy(IconData.szInfoTitle, TipTitle, SizeOf(IconData.szInfoTitle) - 1);
  IconData.dwInfoFlags := NIIF_INFO;     //NIIF_ERROR;  //NIIF_WARNING;
  Shell_NotifyIcon(NIM_MODIFY, @IconData);
  {in my testing, the following code has no use}
  IconData.DUMMYUNIONNAME.uVersion := NOTIFYICON_VERSION;
  if not Shell_NotifyIcon(NIM_SETVERSION, @IconData) then
    ShowMessage('setversion fail');
end;

{here's the deletion procedure}
procedure TForm1.DeleteSysTrayIcon;
begin
  DeallocateHWnd(IconData.Wnd);
  if not Shell_NotifyIcon(NIM_DELETE, @IconData) then
    ShowMessage('delete fail');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  AddSysTrayIcon;
  ShowBalloonTips;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  DeleteSysTrayIcon;
end;

end.







731   [COM/OLE] ¶°ÀÖ´Â ¸ðµç Microsoft Internet Explorer ÀÇ html ºÒ·¯¿À±â  ±è¿µ´ë 2003/03/30 6138 1489
730   [À©µµ¿ìÁî API] IEÀÇ "Áñ°Üã±â ±¸¼º" È­¸é ¶ç¿ì±â  ±è¿µ´ë 2003/03/30 6176 1956
729   [À©µµ¿ìÁî API] µ¥½ºÅ©Å¾ÀÇ ÇöÀç Ä¿¼­À§Ä¡ÀÇ Å¸ÀÌƲ¸í°ú Ŭ·¡½º¸í ±¸ÇÏ±â  ±è¿µ´ë 2003/03/29 4815 1192
728   [À©µµ¿ìÁî API] ¶°ÀÖ´Â ¸ðµç Microsoft Internet Explorer Á×ÀÌ±â  ±è¿µ´ë 2003/03/29 5069 1395
727   [½Ã½ºÅÛ] À©µµ¿ìÁî ÀüüÀÇ ¸¶¿ì½º/Å°º¸µå ÀÔ·Â ±ÝÁö  ±è¿µ´ë 2003/03/29 5645 1399
726   [³×Æ®¿÷/ÀÎÅͳÝ] ÀÎÅͳݿ¡ Á¢¼ÓµÇ¾î ÀÖ´ÂÁö °Ë»çÇÏ±â  ±è¿µ´ë 2003/03/29 5618 1342
725   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] TMemo ½ºÅ©·Ñ ´Ù¿î ½ÃÅ°±â  ±è¿µ´ë 2003/03/29 5003 1408
724   [À©µµ¿ìÁî API] Àüü È­¸é(Full Screen) ¸¸µé±â  ±è¿µ´ë 2003/03/29 5461 1374
723   [À©µµ¿ìÁî API] "½ÃÀÛ"->"ÇÁ·Î±×·¥" ¸Þ´º¿¡ Æú´õ Ãß°¡ÇÏ±â  ±è¿µ´ë 2003/03/29 5234 1314
722   [À©µµ¿ìÁî API] ÆûÀÌ Minimized µÇ¾úÀ»¶§ ±ô¹ÚÀÌ°Ô ÇÏ±â  ±è¿µ´ë 2003/03/29 6632 1707
721   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ListBox¿¡¼­ ¸¶¿ì½º À̵¿½Ã ¾ÆÀÌÅÛÀ» ÈùÆ®·Î º¸¿©ÁÖ±â  ±è¿µ´ë 2003/03/27 4433 1160
720   [½Ã½ºÅÛ] DOS ¸í·É¾î ½ÇÇàÇÏ°í °á°ú ¹Þ¾Æ¿À±â  ±è¿µ´ë 2003/03/27 5611 1340
719   [À©µµ¿ìÁî API] ¾×Ƽºê µ¥½ºÅ©Å¾¿¡ À¥ ÄÁÅÙÆ®°¡ Ç¥½ÃÁßÀÎÁö ¾Ë±â  ±è¿µ´ë 2003/03/27 4650 1255
718   [À©µµ¿ìÁî API] ÀÛ¾÷Ç¥½ÃÁÙÀÇ ½Ã°è °¨Ãß±â/º¸ÀÌ±â  ±è¿µ´ë 2003/03/27 7682 2048
717   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Ä¿¼­(Cursor)ÀÇ À̹ÌÁö ±¸ÇÏ±â  ±è¿µ´ë 2003/03/27 4856 1338
716   [À©µµ¿ìÁî API] ½ºÅ©¸° ¼¼À̹ö On/Off  ±è¿µ´ë 2003/03/27 4396 1083
715   [À©µµ¿ìÁî API] ÈÞÁöÅë ºñ¿ì±â  ±è¿µ´ë 2003/03/27 5663 1385
714   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] IE Toolbar ¿¡ ¹öÆ° ¿Ã¸®±â  ±è¿µ´ë 2003/03/26 12724 1262
713   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ±âº» Popup Memu ¶ç¿ìÁö ¾Ê±â  ±è¿µ´ë 2003/03/26 3998 1045
712   [À©µµ¿ìÁî API] "Àӽà ÀÎÅÍ³Ý ÆÄÀÏ" ÀüºÎ Áö¿ì±â  ±è¿µ´ë 2003/03/26 5635 1307
711   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ¼³Ä¡µÈ ¸ðµç ÇÁ·Î±×·¥ Àоî¿À±â  ±è¿µ´ë 2003/03/26 5898 1520
710   [µ¥ÀÌÅͺ£À̽º] DBGrid ÀÇ ÇöÀç Ä¿¼­ÀÇ Çà/¿­ ±¸ÇÏ±â  ±è¿µ´ë 2003/03/26 5549 1315
709   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] INF ÆÄÀÏ ¼³Ä¡ÇÏ±â  ±è¿µ´ë 2003/03/26 5508 1340
708   [µ¥ÀÌÅͺ£À̽º] BDE Alias ¾øÀÌ Database µ¿ÀûÀ¸·Î ¿¬°áÇÏ±â  ½ÅÈÆÀç 2003/03/24 13057 1192
707   [COM/OLE] Win2k, Win Xp - Active X - Dax error : Access violationÇØ°á(IE»ó¿¡¼­)  ½ÅÈÆÀç 2003/03/20 14717 1292
706   [µ¥ÀÌÅͺ£À̽º] ORA-12571: TNS:packet writer failure  ±è¿µ´ë 2003/03/19 9969 1414
705   [µ¥ÀÌÅͺ£À̽º] DBGrid ÀÇ ¸ðµç Row ¸¦ Select ½ÃÅ°±â(SelectAll)  ±è¿µ´ë 2003/03/18 4616 1078
704   [µ¥ÀÌÅͺ£À̽º] index fileÀÇ °¹¼ö¿Í ¼º´É ¹®Á¦  ±è¿µ´ë 2003/03/17 5535 1413
703   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ListView¿¡ È®ÀåÀÚº° ¾ÆÀÌÄÜ ³Ö±â  ½ÅÈÆÀç 2003/03/15 7341 1240
702   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ScrollBox ¿¡ ¹è°æ±×¸² ³Ö±â  ±è¿µ´ë 2003/03/14 4272 1130
701   [½Ã½ºÅÛ] 'ÀÀ´ä¾øÀ½' ÇÁ·Î¼¼¼­¸¦ °¨ÁöÇÏ´Â À볪´Â ¹æ¹ý  ±¸Ã¢¹Î 2003/03/14 14123 1389
700   [À©µµ¿ìÁî API] ÀÔ·ÂÀ» ±â´Ù¸®´Â Ç®½ºÅ©¸° ÄÜ¼Ö À©µµ¿ì ¸¸µé¾î º¸±â  ±¸Ã¢¹Î 2003/03/14 6859 1205
699   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ƯÁ¤ ·¹Áö½ºÆ®¸® Å° ÀÇ ¸ðµç ¸ñ·ÏÀ» Çѹ濡! Àоî¿À±â  ±¸Ã¢¹Î 2003/03/14 5358 993
  [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Æ®·¹ÀÌ ¾ÆÀÌÄÜ¿¡ dz¼± ÈùÆ® º¸¿©ÁÖ±â  ±¸Ã¢¹Î 2003/03/14 7371 1423
697   [À©µµ¿ìÁî API] ¿ÜºÎ ÇÁ·Î±×·¥ÀÇ »óÅÂÇ¥½ÃÁÙÀÇ Text °¡Á®¿À±â  ±¸Ã¢¹Î 2003/03/14 6470 1461
696   [½Ã½ºÅÛ] IP Address À©µµ¿ì ÆûÀ§¿¡ ¸¸µé¾îº¸±â  ±¸Ã¢¹Î 2003/03/14 5977 1317
695   [½Ã½ºÅÛ] ƯÁ¤ DLL ÀÇ ÇÔ¼ö¸ñ·ÏÀ» ±¸Çغ¸ÀÚ.  ±¸Ã¢¹Î 2003/03/14 6075 1272
694   [½Ã½ºÅÛ] ¾²·¹µå ³»¿¡¼­ ÆûÀ» »ý¼ºÇغ¸ÀÚ  ±¸Ã¢¹Î 2003/03/14 6148 1249
693   [À©µµ¿ìÁî API] ¿ÜºÎ ÇÁ·Î±×·¥ ¸ð´Þ âó·³ ¶ç¿ö¼­ Á¾·áµÉ¶§ ±â´Ù¸®±â(½ÃÁ¡ ¾Ë±â)  ±¸Ã¢¹Î 2003/03/14 6014 1299
692   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ÄÄÆ÷³ÍÆ®¿¡ ¿ÀÇ´ÙÀ̾ó·Î±×¸¦ ¶ç¿ì´Â ¼Ó¼º ¸¸µå´Â ¹æ¹ý  ±¸Ã¢¹Î 2003/03/14 4237 1051

[1][2][3][4][5][6] 7 [8][9][10]..[25] [´ÙÀ½ 10°³]
 

Copyright 1999-2024 Zeroboard / skin by zero