Click here to Skip to main content
15,910,130 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Font heights Pin
0v3rloader13-Jul-04 20:37
0v3rloader13-Jul-04 20:37 
GeneralRe: Font heights Pin
Johan Rosengren13-Jul-04 20:47
Johan Rosengren13-Jul-04 20:47 
GeneralRe: Font heights Pin
0v3rloader13-Jul-04 21:27
0v3rloader13-Jul-04 21:27 
Generalabout MPEG4. Pin
Grrrr13-Jul-04 16:37
Grrrr13-Jul-04 16:37 
Generalgethostbyname() in win32 Pin
edosdonkey13-Jul-04 15:45
edosdonkey13-Jul-04 15:45 
GeneralAn MFC project Pin
sagsag13-Jul-04 13:41
sagsag13-Jul-04 13:41 
GeneralRe: An MFC project Pin
mystro_AKA_kokie13-Jul-04 19:20
mystro_AKA_kokie13-Jul-04 19:20 
Generalfree GMail account to first person who can give working solution Pin
JeromeKJerome13-Jul-04 11:26
JeromeKJerome13-Jul-04 11:26 
Here is an out of control bot. Once the ok dialog button is clicked, the bot works ok, but there is no way to interact with the status bar icon. Before ok is clicked, status icon is responsive, but after clicking, there is no answer, and the only way to interrupt the routine is under debug or by ctl-alt-del shutdown of the process.

I've got one of the much-sought-after free G-Mail account to the first person who can find the mistake here.

Here is an outline of the code:

in BotDlg.h

#define WM_TRAY_NOTIFY WM_USER + 0

...
...

class CBotDlg : public CDialog
{
// Construction
public:
CBotDlg(CWnd* pParent = NULL); // standard constructor
LRESULT OnTrayNotify(WPARAM wParam, LPARAM lParam);
void TakeABreak();
void BackToWork();
void OnMenuExit();
NOTIFYICONDATA m_nTrayData;
bool m_bOnBreak;
bool m_bHidden;

...
...

in BotDlg.cpp

...
...

BEGIN_MESSAGE_MAP(CBotDlg, CDialog)

ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()

ON_MESSAGE (WM_TRAY_NOTIFY, OnTrayNotify)
ON_COMMAND(IDC_BREAK, CBotDlg::TakeABreak)
ON_COMMAND (IDC_WORK, CBotDlg::BackToWork)
ON_COMMAND (IDC_EXIT, CBotDlg::OnMenuExit)

ON_BN_CLICKED(IDOK, OnBnClickedOk)
END_MESSAGE_MAP()

...
...

m_nTrayData.cbSize = sizeof(NOTIFYICONDATA);
m_nTrayData.hWnd = m_hWnd;
m_nTrayData.uID = 0;
m_nTrayData.hIcon = LoadIcon (AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_BREAK));
m_nTrayData.uCallbackMessage = WM_TRAY_NOTIFY;
strcpy (m_nTrayData.szTip, "Bot");
m_nTrayData.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
m_bOnBreak = false;
m_bHidden = false;

return TRUE; // return TRUE unless you set the focus to a control

...
...

// ******************************
// * *
// * Main Process *
// * *
// ******************************
//
// Main Process
//

void CBotDlg::OnBnClickedOk()
{

//go retrieve web pages and follow links
//til no more links

EndDialog(0);

}

// ******************************
// * *
// * OnTrayNotify *
// * *
// ******************************
//
// Tray Notification Handler
//
LRESULT CBotDlg::OnTrayNotify(WPARAM wParam, LPARAM lParam)
{
// ---- Left-button dclick: Exit Program
if (lParam == WM_LBUTTONDBLCLK)
{
Shell_NotifyIcon(NIM_DELETE, &m_nTrayData);
EndDialog(0);
}//end if
// ---- Right-button down: Pop-up menu
if (lParam == WM_RBUTTONDOWN)
{
CMenu menu;
VERIFY (menu.LoadMenu(IDR_MENU1));
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
CRect screen;
GetDesktopWindow()->GetWindowRect(screen);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, screen.right, screen.bottom, AfxGetMainWnd());
}//end if
return LRESULT(0);
}
// ******************************
// * *
// * BackToWork *
// * *
// ******************************
//
// Back to Work Handler
//
void CBotDlg::BackToWork()
{
m_nTrayData.hIcon=LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_WORK));
strcpy (m_nTrayData.szTip, "Bot");
m_nTrayData.uFlags = NIF_ICON | NIF_TIP;
Shell_NotifyIcon (NIM_MODIFY, &m_nTrayData);
}

// ******************************
// * *
// * TakeABreak *
// * *
// ******************************
//
// Take A Break Handler
//
void CBotDlg::TakeABreak()
{
m_nTrayData.hIcon=LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_BREAK));
strcpy (m_nTrayData.szTip, "Bot");
m_nTrayData.uFlags = NIF_ICON | NIF_TIP;
Shell_NotifyIcon (NIM_MODIFY, &m_nTrayData);
}

GeneralRe: free GMail account to first person who can give working solution Pin
Antti Keskinen13-Jul-04 11:47
Antti Keskinen13-Jul-04 11:47 
GeneralRe: free GMail account to first person who can give working solution Pin
JeromeKJerome13-Jul-04 14:14
JeromeKJerome13-Jul-04 14:14 
GeneralRe: free GMail account to first person who can give working solution Pin
naveen_vi13-Jul-04 11:50
naveen_vi13-Jul-04 11:50 
GeneralRe: free GMail account to first person who can give working solution Pin
JeromeKJerome13-Jul-04 14:15
JeromeKJerome13-Jul-04 14:15 
GeneralRe: free GMail account to first person who can give working solution Pin
naveen_vi13-Jul-04 11:53
naveen_vi13-Jul-04 11:53 
GeneralRe: free GMail account to first person who can give working solution Pin
Ryan Binns13-Jul-04 18:17
Ryan Binns13-Jul-04 18:17 
GeneralRe: free GMail account to first person who can give working solution Pin
JeromeKJerome14-Jul-04 15:42
JeromeKJerome14-Jul-04 15:42 
GeneralRe: free GMail account to first person who can give working solution Pin
ThatsAlok13-Jul-04 20:21
ThatsAlok13-Jul-04 20:21 
GeneralRe: free GMail account to first person who can give working solution Pin
JeromeKJerome14-Jul-04 15:36
JeromeKJerome14-Jul-04 15:36 
GeneralRe: free GMail account to first person who can give working solution Pin
ThatsAlok14-Jul-04 21:15
ThatsAlok14-Jul-04 21:15 
QuestionWhat is WINAPI macro??? Pin
naveen_vi13-Jul-04 10:54
naveen_vi13-Jul-04 10:54 
AnswerRe: What is WINAPI macro??? Pin
palbano13-Jul-04 11:13
palbano13-Jul-04 11:13 
AnswerRe: What is WINAPI macro??? Pin
Jeremy Falcon13-Jul-04 11:27
professionalJeremy Falcon13-Jul-04 11:27 
GeneralStream interfaces Pin
pankajdaga13-Jul-04 9:08
pankajdaga13-Jul-04 9:08 
GeneralRe: Stream interfaces Pin
palbano13-Jul-04 9:17
palbano13-Jul-04 9:17 
GeneralRe: Stream interfaces Pin
pankajdaga13-Jul-04 12:14
pankajdaga13-Jul-04 12:14 
GeneralRe: Stream interfaces Pin
Chris Losinger13-Jul-04 15:50
professionalChris Losinger13-Jul-04 15:50 

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.