Click here to Skip to main content
15,899,124 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralGet the coordinates of the AppBar Pin
Eq18-Sep-00 0:55
Eq18-Sep-00 0:55 
GeneralRe: Get the coordinates of the AppBar Pin
Michael Dunn18-Sep-00 7:18
sitebuilderMichael Dunn18-Sep-00 7:18 
GeneralError in running Script control Pin
Reny j joseph thuthikattu17-Sep-00 21:37
Reny j joseph thuthikattu17-Sep-00 21:37 
GeneralVC++ conversion urgent Pin
Guruprasad17-Sep-00 18:05
Guruprasad17-Sep-00 18:05 
GeneralRe: VC++ conversion urgent Pin
Dark Angel18-Sep-00 4:34
Dark Angel18-Sep-00 4:34 
GeneralUsing 256 color icons in CTreeCtrl Pin
Mustafa Demirhan16-Sep-00 23:45
Mustafa Demirhan16-Sep-00 23:45 
GeneralSystem Tray Pin
kennan16-Sep-00 23:07
kennan16-Sep-00 23:07 
GeneralRe: System Tray Pin
Mustafa Demirhan16-Sep-00 23:27
Mustafa Demirhan16-Sep-00 23:27 
Here is an example about adding icon to the system tary:
<br />
#define WM_MY_NOTIFYICON	WM_USER+100<br />
<br />
BOOL CMainFrame::TrayMessage(DWORD dwMessage, UINT uID, HICON hIcon, PSTR pszTip)<br />
{<br />
    BOOL res;<br />
<br />
	NOTIFYICONDATA tnd;<br />
<br />
	tnd.cbSize		= sizeof(NOTIFYICONDATA);<br />
	tnd.hWnd		= m_hWnd;<br />
	tnd.uID			= uID;<br />
<br />
	tnd.uFlags		= NIF_MESSAGE|NIF_ICON|NIF_TIP;<br />
	tnd.uCallbackMessage	= WM_MY_NOTIFYICON;<br />
	tnd.hIcon		= hIcon;<br />
	if (pszTip)<br />
	{<br />
		lstrcpyn(tnd.szTip, pszTip, sizeof(tnd.szTip));<br />
	}<br />
	else<br />
	{<br />
		tnd.szTip[0] = '\0';<br />
	}<br />
<br />
	res = Shell_NotifyIcon(dwMessage, &tnd);<br />
<br />
	if (hIcon)<br />
	    DestroyIcon(hIcon);<br />
<br />
	return res;<br />
}<br />
<br />
void CMainFrame::NotifyDelete()<br />
{<br />
	HICON hIcon;<br />
	CWinApp *theApp=::AfxGetApp();<br />
	hIcon=theApp->LoadIcon(IDR_MAINFRAME);<br />
	TrayMessage(NIM_DELETE, IDR_MAINFRAME, hIcon, "WinScheduler");<br />
}<br />
<br />
void CMainFrame::NotifyAdd()<br />
{<br />
	HICON hIcon;<br />
	CWinApp *theApp=::AfxGetApp();<br />
	hIcon=theApp->LoadIcon(IDR_MAINFRAME);<br />
	TrayMessage(NIM_ADD, IDR_MAINFRAME, hIcon, "WinScheduler");<br />
}<br />
<br />
long CMainFrame::OnTrayIconNotify(WPARAM wParam, LPARAM lParam)<br />
{<br />
	switch (lParam)<br />
	{<br />
	case WM_LBUTTONDOWN:<br />
		{<br />
			CWinApp *theApp=::AfxGetApp();<br />
			CWnd *mainWnd=theApp->m_pMainWnd;<br />
			if(mainWnd->IsIconic())<br />
			{<br />
				mainWnd->ShowWindow(SW_RESTORE);<br />
			}<br />
			mainWnd->SetForegroundWindow();<br />
		}<br />
		break;<br />
	case WM_RBUTTONDOWN:<br />
		break;<br />
	}<br />
	return 0;<br />
}<br />

Then add
ON_MESSAGE(WM_MY_NOTIFYICON, OnTrayIconNotify)
between
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) and
END_MESSAGE_MAP()

This adds an icon to the system tray and when you click on it it activates the window.
There is an article about removing your program's from taskbar in this site.

Best Regards.
Mustafa Demirhan
GeneralRe: System Tray Pin
Mustafa Demirhan16-Sep-00 23:30
Mustafa Demirhan16-Sep-00 23:30 
GeneralRe: System Tray Pin
Sam Hobbs17-Sep-00 19:45
Sam Hobbs17-Sep-00 19:45 
GeneralMFC, API Pin
kennan16-Sep-00 22:06
kennan16-Sep-00 22:06 
GeneralRe: MFC, API Pin
Paolo Messina16-Sep-00 22:48
professionalPaolo Messina16-Sep-00 22:48 
GeneralProblem with getting file and line from ImageHlp.dll Pin
Stephen Kellett16-Sep-00 5:31
Stephen Kellett16-Sep-00 5:31 
GeneralRe: Problem with getting file and line from ImageHlp.dll Pin
Gert Boddaert18-Sep-00 1:58
Gert Boddaert18-Sep-00 1:58 
GeneralRe: Problem with getting file and line from ImageHlp.dll Pin
Stephen Kellett26-Sep-00 2:08
Stephen Kellett26-Sep-00 2:08 
GeneralRe: Problem with getting file and line from ImageHlp.dll Pin
Gert Boddaert26-Sep-00 2:29
Gert Boddaert26-Sep-00 2:29 
GeneralProblems with Platform SDK Pin
Stephen Kellett16-Sep-00 5:26
Stephen Kellett16-Sep-00 5:26 
GeneralRe: Problems with Platform SDK Pin
mg29-Sep-00 6:45
mg29-Sep-00 6:45 
GeneralTransparentBlt Pin
David15-Sep-00 18:41
David15-Sep-00 18:41 
GeneralDialog resolution Pin
Roger15-Sep-00 7:40
Roger15-Sep-00 7:40 
GeneralRe: Dialog resolution Pin
Mustafa Demirhan16-Sep-00 0:00
Mustafa Demirhan16-Sep-00 0:00 
GeneralISAPI Pin
Ed K19-Sep-00 12:19
Ed K19-Sep-00 12:19 
GeneralRe: ISAPI Pin
Member 120896520-Sep-00 14:01
Member 120896520-Sep-00 14:01 
GeneralFailure to Register DropTarget only on HP Vectra and Win 2000 Pin
Member 1031214815-Sep-00 6:13
Member 1031214815-Sep-00 6:13 
General*** Changing Title of a Document Frame **** Pin
Steve Lai15-Sep-00 6:02
Steve Lai15-Sep-00 6:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.