Go Back   Armenian Knowledge Base > Technical sections > Languages, Compilers, Interpreters

Reply
 
Thread Tools

BCB and System Tray in widovuZZZ
Old 30.08.2002, 06:30   #1
Младенец
 
Join Date: 08 2002
Location: out there
Posts: 38
Rep Power: 0
Question BCB and System Tray in widovuZZZ

How can i put icon in system tray (m$ win) with BCB (Borland C++ Builder) ?

Old 30.08.2002, 07:43   #2
Дошкольник
 
Join Date: 08 2002
Location: Erevan
Posts: 120
Rep Power: 0
Post

Na Visual Basic znayu, esli Ponadobitsya

Old 30.08.2002, 15:29   #3
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Rep Power: 0
Post

sozdaesh structuru NOTIFYICONDATA, zapolnyaesh, potom ispol'zuesh Shell_NotifyIcon

podrobnee chitay v helpax

Old 03.09.2002, 16:46   #4
Дошкольник
 
Join Date: 10 2001
Location: Armenia
Posts: 61
Rep Power: 0
Post

Kakoi u tebya builder? esli 5.0 to u nevo klass est' TNotifyEvent poprobuy eto...

V protivnom sluchae dolzhen postupit' navernoe tak kak skazal z0mbie...

Old 03.09.2002, 18:00   #5
¡no pasaran!
 
dolphin's Avatar
 
Join Date: 03 2002
Location: localhost
Age: 42
Posts: 540
Rep Power: 5
Smile

da, 5.0

ok, togda esche vopros na zasypku:

Kak v windoze emulirovat' COM port?

real'no-li eto realizovat' v BCB ili nujno nizkourovnevoe programmirovanie (asm?).

Old 03.09.2002, 19:41   #6
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Rep Power: 0
Post

CreateFile,ReadFile,WriteFile

Old 03.09.2002, 21:32   #7
¡no pasaran!
 
dolphin's Avatar
 
Join Date: 03 2002
Location: localhost
Age: 42
Posts: 540
Rep Power: 5
Post

Zombi, ty menja ne pravil'no ponjal. Mne nujno sozdat' svojsobstvennyj virtual'nyj COM port, a ne pisat' v fizicheski sushestvujushij.

Old 03.09.2002, 21:54   #8
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Rep Power: 0
Post

a popodrobnee ? kto i kak k nemu budet obrashat'sya ?

Old 03.09.2002, 22:20   #9
¡no pasaran!
 
dolphin's Avatar
 
Join Date: 03 2002
Location: localhost
Age: 42
Posts: 540
Rep Power: 5
Post

tipa COM 5 kotorogo net..

i 2 funkcii

int vcom_send(int port);
int vcom_read(int port);

Old 06.09.2002, 23:55   #10
Младенец
 
Join Date: 07 2002
Location: PutinsBurg, Russia
Posts: 2
Rep Power: 0
Post

Quote:
Originally posted by thebug:
How can i put icon in system tray (m$ win) with BCB (Borland C++ Builder) ?
in *.h
...
#define MYWM_NOTIFY WM_USER
#define IDC_MYICON 1006
...
void __fastcall DrawItem(TMessage& Msg);
void __fastcall MyNotify(TMessage& Msg);
...
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_DRAWITEM, TMessage, DrawItem)
MESSAGE_HANDLER(MYWM_NOTIFY, TMessage, MyNotify)
END_MESSAGE_MAP(TForm)

in *.cpp
LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi)
{
HICON hIcon;
hIcon = (HICON)LoadImage(Application->Handle, MAKEINTRESOURCE(lpdi->CtlID),
IMAGE_ICON, 16, 16, 0);
if (!hIcon)
return(FALSE);
DrawIconEx(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top, hIcon,
16, 16, 0, NULL, DI_NORMAL);
return(TRUE);
}
//---------------------------------------------------------------------------
void __fastcall TFrm:rawItem(TMessage& Msg)
{
IconDrawItem((LPDRAWITEMSTRUCT)Msg.LParam);
TForm:ispatch(&Msg);
}
//---------------------------------------------------------------------------
void __fastcall TFrm::MyRestore(TMessage& Msg)
{
AppRestoreClick(NULL);
}
//---------------------------------------------------------------------------
void __fastcall TFrm::MyNotify(TMessage& Msg)
{
POINT MousePos;

switch(Msg.LParam)
{
case WM_RBUTTONUP:
if (GetCursorPos(&MousePos))
{
PopupMenu->PopupComponent = Frm;
SetForegroundWindow(Handle);
PopupMenu->Popup(MousePos.x, MousePos.y);
}
else
Show();
break;
/*case WM_LBUTTONUP: */ //TrayMessage(NIM_MODIFY); break;

case WM_LBUTTONDBLCLK: AppRestoreClick(NULL); break;

default:
break;
}
TForm:ispatch(&Msg);
}
//---------------------------------------------------------------------------
bool __fastcall TFrm::TrayMessage(DWORD dwMessage)
{
NOTIFYICONDATA tnd;

tnd.cbSize = sizeof(NOTIFYICONDATA);
tnd.hWnd = Handle;
tnd.uID = IDC_MYICON;
tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
tnd.uCallbackMessage = MYWM_NOTIFY;

if (dwMessage == NIM_MODIFY)
{
tnd.hIcon = (HICON)Application->Icon->Handle;
lstrcpyn(tnd.szTip, Application->Title.c_str(), sizeof(tnd.szTip));
}
else
{
tnd.hIcon = NULL;
tnd.szTip[0] = '\0';
}

return (Shell_NotifyIcon(dwMessage, &tnd));
}

to set tray:
TrayMessage(NIM_ADD);
TrayMessage(NIM_MODIFY);
to delete:
TrayMessage(NIM_DELETE);
TrayMessage(NIM_MODIFY);

Old 16.10.2002, 07:42   #11
Студент
 
Join Date: 03 2002
Location: [ Surrealistical World ]
Posts: 312
Rep Power: 0
Post

Tut eshe vopros... A kak perexvatit' WM_* na etoy systray-ovskoy ikonke?? Thx.

Old 16.10.2002, 13:48   #12
Младенец
 
Join Date: 10 2002
Location: Chicago NW Suburbs, IL, US
Posts: 14
Rep Power: 0
Post

Quote:
Tut eshe vopros... A kak perexvatit' WM_* na etoy systray-ovskoy ikonke?? Thx.
А иконка в трейе отдельным окном не является, поэтому своих мессаджей у нее как бы и нет.
Отслеживать можно только операции мышкой - в примере это было.

Можешь посмотреть Spy++-ом.

В ХР правда есть доп. возжможности, но суть все равно не меняется.

А что конкретно надо сделать?
Reply




Реклама:
реклама

All times are GMT. The time now is 00:32.
Top

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.