|
测试了一下,还是不行啊!
用托盘程序可以添加窗口程序(应该是对话框窗口)到任务栏上.但是,调用ShowWindow(SW_HIDE)函数以后,窗口和任务栏一起隐藏了.怎么点也搞不出任务栏和开始菜单.不知道怎么回事.
偶在BOOL CHomeScreenDlg::OnInitDialog()函数中放了:
NOTIFYICONDATA tnid;
tnid.cbSize = sizeof(NOTIFYICONDATA);
tnid.hIcon = m_hIcon;
tnid.hWnd = hWnd;
tnid.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP;
tnid.uCallbackMessage = WM_MY_NOTIFY;
tnid.uID = IDR_MAINFRAME;
_tcscpy(tnid.szTip, TEXT("Click Here!"));
Shell_NotifyIcon(NIM_ADD,&tnid);
在最小化按钮函数中:
void CHomeScreenDlg::OnOK()
{
// TODO: Add extra validation here
if(MessageBox(_T("Are you sure to exit?\r\n 确定要退出吗?"),
_T("警告"), MB_YESNO) == IDNO)
{
ShowWindow(SW_HIDE);
return;
}
Cleanup();
CDialog::OnOK();
}
回调的消息函数是:
void CHomeScreenDlg::OnCLickHereMessage(WPARAM wParam,LPARAM lParam)
{
UINT uID;
INT uMouseMsg;
POINT pt;
uID=(UINT)wParam;
uMouseMsg=(UINT)lParam;
if(uMouseMsg == WM_RBUTTONDOWN || uMouseMsg == WM_LBUTTONDOWN)
{
switch(uID)
{
case IDR_MAINFRAME:
GetCursorPos(&pt);
ShowWindow(SW_SHOW);
break;
default:
break;
}
}
return;
}
请高手指点,怎么可以实现最小化,而且又能使任务栏可见?
|
|