Armenian Knowledge Base  

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

Reply
 
LinkBack Thread Tools
Old 30.08.2002, 07:30   #1
Младенец
 
Join Date: 08 2002
Location: out there
Posts: 38
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Question BCB and System Tray in widovuZZZ

How can i put icon in system tray (m$ win) with BCB (Borland C++ Builder) ?
Reply With Quote
Old 30.08.2002, 08:43   #2
Дошкольник
 
Join Date: 08 2002
Location: Erevan
Posts: 120
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Post

Na Visual Basic znayu, esli Ponadobitsya
Reply With Quote
Old 30.08.2002, 16:29   #3
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Downloads: 1
Uploads: 0
Reputation: 0 | 0
Post

sozdaesh structuru NOTIFYICONDATA, zapolnyaesh, potom ispol'zuesh Shell_NotifyIcon

podrobnee chitay v helpax
Reply With Quote
Old 03.09.2002, 17:46   #4
Дошкольник
 
Join Date: 10 2001
Location: Armenia
Posts: 61
Downloads: 0
Uploads: 0
Reputation: 0 | 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...
Reply With Quote
Old 03.09.2002, 19:00   #5
¡no pasaran!
 
dolphin's Avatar
 
Join Date: 03 2002
Location: localhost
Age: 35
Posts: 540
Downloads: 0
Uploads: 0
Reputation: 13 | 4
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?).
Reply With Quote
Old 03.09.2002, 20:41   #6
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Downloads: 1
Uploads: 0
Reputation: 0 | 0
Post

CreateFile,ReadFile,WriteFile
Reply With Quote
Old 03.09.2002, 22:32   #7
¡no pasaran!
 
dolphin's Avatar
 
Join Date: 03 2002
Location: localhost
Age: 35
Posts: 540
Downloads: 0
Uploads: 0
Reputation: 13 | 4
Post

Zombi, ty menja ne pravil'no ponjal. Mne nujno sozdat' svojsobstvennyj virtual'nyj COM port, a ne pisat' v fizicheski sushestvujushij.
Reply With Quote
Old 03.09.2002, 22:54   #8
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Downloads: 1
Uploads: 0
Reputation: 0 | 0
Post

a popodrobnee ? kto i kak k nemu budet obrashat'sya ?
Reply With Quote
Old 03.09.2002, 23:20   #9
¡no pasaran!
 
dolphin's Avatar
 
Join Date: 03 2002
Location: localhost
Age: 35
Posts: 540
Downloads: 0
Uploads: 0
Reputation: 13 | 4
Post

tipa COM 5 kotorogo net..

i 2 funkcii

int vcom_send(int port);
int vcom_read(int port);
Reply With Quote
Old 07.09.2002, 00:55   #10
Младенец
 
Join Date: 07 2002
Location: PutinsBurg, Russia
Posts: 2
Downloads: 0
Uploads: 0
Reputation: 0 | 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);
Reply With Quote
Old 16.10.2002, 08:42   #11
Студент
 
Join Date: 03 2002
Location: [ Surrealistical World ]
Posts: 312
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Post

Tut eshe vopros... A kak perexvatit' WM_* na etoy systray-ovskoy ikonke?? Thx.
Reply With Quote
Old 16.10.2002, 14:48   #12
Младенец
 
Join Date: 10 2002
Location: Chicago NW Suburbs, IL, US
Posts: 14
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Post

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

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

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

А что конкретно надо сделать?
Reply With Quote
Sponsored Links
Reply

Thread Tools


На правах рекламы:
реклама

All times are GMT. The time now is 19:48.


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