- 浏览: 343044 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
CFJAVA:
分析的真仔细,拜读了!
深入剖析SolrCloud(三) -
cc3514772b:
目前也在使用solr ,想跟lz交流下。。
深入剖析SolrCloud(三)
XBalloonMsg - a non-MFC balloon-shaped message box
只需要调用下面两个函数:
Function |
Description |
void Show() |
显示气泡状信息 |
void Destroy() |
从屏幕上删除气泡状信息 |
//specialsymbolfortitlestring-replacedwithmodulename
#defineLPCTSTR_DEFAULT_TITLE((LPCTSTR)-1L)
//=============================================================================
classCXBalloonMsg
//=============================================================================
{
//Construction
public:
CXBalloonMsg();
virtual~CXBalloonMsg();
//Attributes
public:
staticHWNDm_hWndBalloon;
//Operations
public:
staticvoidShow(LPCTSTRlpszTitle,
LPCTSTRlpszMsg,
HWNDhCtrl,
HWNDhParent,
HINSTANCEhInstance,
UINTnIcon=TTI_INFO,
BOOLbUseBalloonTips=TRUE,
UINTnTimeOutSeconds=0,
LPRECTpRect=NULL);
staticvoidDestroy();
//Implementation
protected:
staticLRESULTCALLBACKKeyboardProc(intnCode,WPARAMwParam,LPARAMlParam);
staticLRESULTCALLBACKMouseProc(intnCode,WPARAMwParam,LPARAMlParam);
staticLRESULT__stdcallDefWindowProcX(HWNDhWnd,
UINTmessage,
WPARAMwParam,
LPARAMlParam);
staticvoidCALLBACKTimerProcX(HWNDhwnd,
UINTmessage,
UINT_PTRnIdEvent,
DWORDdwTime);
staticBOOLGetEnableBalloonTips();
staticvoidGetStrings(LPCTSTRlpszTitle,LPCTSTRlpszMsg,HINSTANCEhInstance);
staticTCHAR*GetModuleName(HINSTANCEhInstance);
staticvoidPositionBalloon(LPRECTpRect,LPRECTpNewRect,BOOLbBalloon);
staticBOOLm_bInit;//TRUE=initializationfinished
staticBOOLm_bUseBalloonTips;//TRUE=useballoontipsifpossible
staticBOOLm_bBalloon;//TRUE=balloontipsnotdisallowedin
//registry
staticHINSTANCEm_hInstance;//appinstance
staticUINTm_nIcon;//icontouse
staticUINTm_nLastMessage;//lastmessagereceived
staticUINTm_nTimeOutSeconds;//messagetimeoutinseconds;
//0=notimeout
staticUINTm_nTimerId;//timeridreturnedbySetTimer()
staticLPRECTm_pRect;//NULL=usecontrolrect
staticHWNDm_hWnd;//hwndofCXBalloonMsg
staticHWNDm_hParent;//parenthwnd
staticHWNDm_hCtrl;//controlhwnd
staticWNDPROCm_wndProc;//windowprocforparentsubclassing
staticHHOOKm_hKeyboardHook;//keyboardhook
staticHHOOKm_hMouseHook;//mousehook
staticTCHARm_szTitle[500];//titlestring
staticTCHARm_szMsg[4000];//messagestring
};
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->//=============================================================================
//classvariables
//=============================================================================
BOOLCXBalloonMsg::m_bInit=FALSE;//未初始化
BOOLCXBalloonMsg::m_bUseBalloonTips=TRUE;//默认使用气泡效果
BOOLCXBalloonMsg::m_bBalloon=TRUE;
HINSTANCECXBalloonMsg::m_hInstance=0;
UINTCXBalloonMsg::m_nIcon=TTI_INFO;
UINTCXBalloonMsg::m_nLastMessage=0;
UINTCXBalloonMsg::m_nTimeOutSeconds=0;
UINTCXBalloonMsg::m_nTimerId=0;
LPRECTCXBalloonMsg::m_pRect=0;
HWNDCXBalloonMsg::m_hWnd=0;
HWNDCXBalloonMsg::m_hParent=0;
HWNDCXBalloonMsg::m_hCtrl=0;
HWNDCXBalloonMsg::m_hWndBalloon=0;
WNDPROCCXBalloonMsg::m_wndProc=0;
HHOOKCXBalloonMsg::m_hKeyboardHook=0;
HHOOKCXBalloonMsg::m_hMouseHook=0;
TCHARCXBalloonMsg::m_szTitle[]={0};
TCHARCXBalloonMsg::m_szMsg[]={0};
//=============================================================================
CXBalloonMsg::CXBalloonMsg()
//=============================================================================
{
}
//=============================================================================
CXBalloonMsg::~CXBalloonMsg()
//=============================================================================
{
if(m_wndProc&&IsWindow(m_hParent))
::SetWindowLong(m_hParent,GWL_WNDPROC,(LONG)m_wndProc);//保存窗口处理过程
m_wndProc=0;
}
//=============================================================================
//
//Show()
//
//Purpose:TheShow()functioncreates,displays,andoperatesa
//balloonmessagebox.Themessageboxcontainsan
//application-definedmessageandtitle,aclosebutton,
//andanoptionalicon.
//
//Parameters:lpszTitle-[in]Pointertoanull-terminatedstring
//thatcontainstheballoonmessagetitle.
//IfthisparameterisNULL,notitleand
//noiconwillbedisplayed.Thespecial
//symbolLPCTSTR_DEFAULT_TITLEmaybeused;
//itwillcausetheexecutablemodulename
//tobedisplayed.
//lpszMsg-[in]Pointertoanull-terminatedstring
//thatcontainstheballoonmessagetobe
//displayed.Mustnotbenull.
//hCtrl-[in]Handletothecontrolthatthe
//messageisbeingdisplayedfor.Mustnot
//benull.
//hParent-[in]Handletotheparentwindowofthe
//control.Mustnotbenull.
//hInstance-[in]Handletotheinstanceofthemodule
//thatcontainsthestringresource.May
//benullifstringresourceisnotused.
//nIcon-[in]Specifiestheicontoassociatewith
//theballoonmessage.
//bUseBalloonTips-[in]Specifieswhetherballoontipsare
//tobeusedtodisplaythemessage.If
//thisparameterisTRUE,balloontipswill
//beusedunlessdisabledintheregistry.
//IfthisparameterisFALSE,regular
//tooltipswillbeused,regardlessofvalue
//ofregistrykey.Ifnotpresent,this
//parameterdefaultstoTRUE.
//nTimeOutSeconds-[in]Specifiesnumberofsecondsbeforethe
//balloonmessageisautomaticallyclosed.If
//thisparameteriszero,theballoonmessage
//willnotbeautomaticallyclosed.Ifnot
//present,thisparameterdefaultstozero.
//pRect-[in]PointertoaRECTstructthatcontains
//positionwhereballoonmessageistobe
//displayed.Maybenullifdefaultposition
//shouldbeused.Ifnotpresent,this
//parameterdefaultstonull.
//
//Returns:None
//
voidCXBalloonMsg::Show(LPCTSTRlpszTitle,
LPCTSTRlpszMsg,
HWNDhCtrl,
HWNDhParent,
HINSTANCEhInstance,
UINTnIcon/**//*=TTI_INFO*/,
BOOLbUseBalloonTips/**//*=TRUE*/,
UINTnTimeOutSeconds/**//*=0*/,
LPRECTpRect/**//*=NULL*/)
{
_ASSERTE(lpszMsg);
_ASSERTE(hCtrl);
_ASSERTE(hParent);
if(!lpszMsg||!hCtrl||!hParent)
{
TRACE(_T("ERROR-badparameter/n"));
return;
}
if(!IsWindow(hCtrl)||!IsWindow(hParent))
{
TRACE(_T("ERROR-notavalidwindowhandle/n"));
return;
}
Destroy();//销毁以前的
m_hParent=hParent;
m_hCtrl=hCtrl;
m_hInstance=hInstance;
m_nIcon=nIcon;
m_pRect=pRect;
m_bUseBalloonTips=bUseBalloonTips;
m_nTimeOutSeconds=nTimeOutSeconds;
m_nTimerId=0;
GetStrings(lpszTitle,lpszMsg,hInstance);//加载字符串
//makesurethere'samessage
_ASSERTE(m_szMsg[0]!=_T('/0'));
if(m_szMsg[0]==_T('/0'))
return;
m_bInit=FALSE;//初始化还未完成
m_nLastMessage=0;
TCHAR*pszClassName=_T("XBalloonMsg");
WNDCLASSwc=
{
CS_DBLCLKS,//classstyle-wantWM_LBUTTONDBLCLK
DefWindowProcX,//windowproc
0,//classextrabytes
0,//windowextrabytes
hInstance,//instancehandle
0,//icon
::LoadCursor(0,IDC_ARROW),//cursor
0,//backgroundbrush
0,//menuname
pszClassName//classname
};
if(!::RegisterClass(&wc))
{//注册窗口类
DWORDdwLastError=GetLastError();
if(dwLastError!=ERROR_CLASS_ALREADY_EXISTS)
{
TRACE(_T("ERROR-RegisterClassfailed,GetLastError()returned%u/n"),dwLastError);
_ASSERTE(FALSE);
return;
}
}
m_hWnd=::CreateWindowEx(0,pszClassName,_T(""),WS_POPUP|WS_VISIBLE,
30000,30000,10,10,
m_hParent,(HMENU)0,hInstance,0);
if(!m_hWnd)
{
TRACE(_T("ERROR-CreateWindowExfailed/n"));
_ASSERTE(m_hWnd);
}
else
{
::SetWindowPos(m_hParent,m_hWnd,0,0,0,0,
SWP_NOMOVE|SWP_NOSIZE);
}
}
//=============================================================================
//
//Destroy()
//
//Purpose:TheDestroy()functionremovestheballoontipfromthe
//screenanddestroysthetooltipwindow.
//
//Parameters:None
//
//Returns:None
//
voidCXBalloonMsg::Destroy()
{
TRACE(_T("inCXBalloonMsg::Destroy/n"));
if(m_nTimerId)
::KillTimer(0,m_nTimerId);
m_nTimerId=0;
if(m_wndProc&&IsWindow(m_hParent))
::SetWindowLong(m_hParent,GWL_WNDPROC,(LONG)m_wndProc);
m_wndProc=0;
if(IsWindow(m_hWndBalloon))
{
::SendMessage(m_hWndBalloon,TTM_POP,0,0);
::PostMessage(m_hWndBalloon,WM_CLOSE,0,0);
}
m_hWndBalloon=0;
if(IsWindow(m_hWnd))
::DestroyWindow(m_hWnd);
}
//=============================================================================
//
//KeyboardProc()
//
//Purpose:CallbackfunctionsetbytheSetWindowsHookEx()function.
//Thesystemcallsthisfunctionwheneveranapplication
//callstheGetMessageorPeekMessagefunctionandthereisa
//keyboardmessage(WM_KEYUPorWM_KEYDOWN)tobeprocessed.
//
//Parameters:nCode-hookcode
//wParam-virtual-keycode
//lParam-keystroke-messageinformation
//
//Returns:LRESULT-1topreventthesystemfrompassingthemessageon;
//orthereturnvaluefromCallNextHookEx().
//
LRESULTCALLBACKCXBalloonMsg::KeyboardProc(intnCode,
WPARAMwParam,
LPARAMlParam)
{
if((nCode>=0)&&
((lParam&0x80000000)==0)&&//ignorekeyreleases
(wParam!=VK_CONTROL)&&
(wParam!=VK_SHIFT)&&
(wParam!=VK_MENU))
{
LRESULTrc=1;
if(wParam==VK_ESCAPE||
wParam==VK_RETURN||
wParam==VK_TAB||
wParam==VK_LEFT||
wParam==VK_UP||
wParam==VK_RIGHT||
wParam==VK_DOWN||
((wParam>=VK_F1)&&(wParam<=VK_F24))
)
{
//don'tforwardthesekeystrokes
}
else
{
rc=CallNextHookEx(m_hKeyboardHook,nCode,wParam,lParam);
}
Destroy();
returnrc;
}
returnCallNextHookEx(m_hKeyboardHook,nCode,wParam,lParam);
}
//=============================================================================
//
//MouseProc()
//
//Purpose:CallbackfunctionsetbytheSetWindowsHookEx()function.
//Thesystemcallsthisfunctionwheneveranapplication
//callstheGetMessageorPeekMessagefunctionandthereisa
//mousemessagetobeprocessed.
//
//Parameters:nCode-hookcode
//wParam-messageidentifier
//lParam-mousecoordinates
//
//Returns:LRESULT-thereturnvaluefromCallNextHookEx().
//
LRESULTCALLBACKCXBalloonMsg::MouseProc(intnCode,
WPARAMwParam,
LPARAMlParam)
{
LRESULTrc=CallNextHookEx(m_hMouseHook,nCode,wParam,lParam);
if(nCode>=0)
{
if(wParam==WM_LBUTTONDOWN||
wParam==WM_RBUTTONDOWN||
wParam==WM_MBUTTONDOWN||
wParam==WM_NCLBUTTONDOWN||
wParam==WM_NCRBUTTONDOWN||
wParam==WM_NCMBUTTONDOWN||
wParam==WM_MOUSEWHEEL)
{
Destroy();
}
}
returnrc;
}
//=============================================================================
//
//TimerProcX()
//
//Purpose:CallbackfunctionthatprocessesWM_TIMERmessages.Itisset
//bySetTimer()ifcallerhasspecifiedamessagetimeout.
//
//Parameters:hwnd-handletowindow
//message-WM_TIMERmessage
//nIdEvent-timeridentifier
//dwTime-currentsystemtime
//
//Returns:None
//
voidCALLBACKCXBalloonMsg::TimerProcX(HWND/**//*hwnd*/,
UINT/**//*message*/,
UINT_PTR/**//*nIdEvent*/,
DWORD/**//*dwTime*/)
{
Destroy();
}
//=============================================================================
//
//DefWindowProcX()
//
//Purpose:WindowproctodispatchmessagesforCXBalloonMsg.Also
//usedtosubclassparentwindowtotrapUImessages.
//
//Parameters:Standardwindowsmessageparameters.
//
//Returns:LRESULT-Thereturnvalueistheresultofthemessage
//processinganddependsonthemessage.
//
LRESULT__stdcallCXBalloonMsg::DefWindowProcX(HWNDhWnd,
UINTmessage,
WPARAMwParam,
LPARAMlParam)
{
switch(message)
{
caseWM_DESTROY:
if(m_hKeyboardHook)
::UnhookWindowsHookEx(m_hKeyboardHook);//卸载键盘钩子
m_hKeyboardHook=0;
if(m_hMouseHook)
::UnhookWindowsHookEx(m_hMouseHook);//卸载鼠标钩子
m_hMouseHook=0;
if(IsWindow(m_hParent))
{
::UpdateWindow(m_hParent);//通知父窗口刷新
//checkifanotherappnowisactive
if(m_nLastMessage==WM_ACTIVATE)
{
//thisrestores"activecaption"toparent
::SetWindowPos(m_hParent,0,0,0,0,0,
SWP_DRAWFRAME|SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE);
}
}
break;
caseWM_WINDOWPOSCHANGED:
{
if(!m_bInit&&(m_hWndBalloon==0))
{
DWORDdwStyle=WS_POPUP|WS_VISIBLE|TTS_ALWAYSTIP|TTS_NOPREFIX|
TTS_CLOSE|TTS_NOFADE|TTS_NOANIMATE;
m_bBalloon=GetEnableBalloonTips();
if(m_bBalloon&&m_bUseBalloonTips)
dwStyle|=TTS_BALLOON;
m_hWndBalloon=::CreateWindowEx(0,TOOLTIPS_CLASS,0,dwStyle,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
m_hParent,0,0,0);
_ASSERTE(m_hWndBalloon);
if(m_hWndBalloon)
{
if(m_wndProc==0&&IsWindow(m_hParent))
{
m_wndProc=(WNDPROC)::SetWindowLong(m_hParent,GWL_WNDPROC,(LONG)DefWindowProcX);
if(m_wndProc)
{
TRACE(_T("parentsuccessfullysubclassed/n"));
}
else
{
TRACE(_T("ERROR-parentsubclassfailed/n"));
}
}
TOOLINFOti;
::ZeroMemory(&ti,sizeof(ti));
ti.cbSize=sizeof(ti);
//usingTTF_TRACKcausesballoontobedisplayedunderneathcontrol
ti.uFlags=TTF_TRACK;
if(m_bBalloon&&m_bUseBalloonTips)
ti.uFlags|=TTF_CENTERTIP;
ti.hwnd=m_hParent;
ti.lpszText=(LPTSTR)m_szMsg;
ti.uId=10001;
ti.hinst=m_hInstance;
if(IsWindow(m_hWndBalloon))
{
::SendMessage(m_hWndBalloon,TTM_SETMAXTIPWIDTH,0,32000);
::SendMessage(m_hWndBalloon,TTM_SETDELAYTIME,TTDT_AUTOPOP,MAKELONG(1,0));
::SendMessage(m_hWndBalloon,TTM_SETDELAYTIME,TTDT_INITIAL,MAKELONG(1,0));
::SendMessage(m_hWndBalloon,TTM_SETDELAYTIME,TTDT_RESHOW,MAKELONG(1,0));
::SendMessage(m_hWndBalloon,TTM_ADDTOOL,0,(LPARAM)&ti);
::SendMessage(m_hWndBalloon,TTM_SETTITLE,(WPARAM)m_nIcon,(LPARAM)m_szTitle);
RECTrectTip;
PositionBalloon(m_pRect,&rectTip,m_bBalloon&m_bUseBalloonTips);
::SendMessage(m_hWndBalloon,TTM_TRACKPOSITION,(WPARAM)0,
(LPARAM)MAKELONG(rectTip.left,rectTip.top));
::SendMessage(m_hWndBalloon,TTM_TRACKACTIVATE,(WPARAM)TRUE,(LPARAM)&ti);
if(!m_hKeyboardHook)
{
m_hKeyboardHook=::SetWindowsHookEx(WH_KEYBOARD,
KeyboardProc,
NULL,::GetCurrentThreadId());
_ASSERTE(m_hKeyboardHook);
}
if(!m_hMouseHook)
{
m_hMouseHook=::SetWindowsHookEx(WH_MOUSE,
MouseProc,
NULL,::GetCurrentThreadId());
_ASSERTE(m_hMouseHook);
}
if(m_nTimeOutSeconds)
{
m_nTimerId=::SetTimer(0,1,m_nTimeOutSeconds*1000,TimerProcX);
}
m_bInit=TRUE;
}
}
}
return0;
break;
}
caseWM_ACTIVATE:
//lParamwillbezeroifanotherappisnowactive
m_nLastMessage=(lParam!=0)?WM_ACTIVATE:0;
caseWM_KILLFOCUS:
caseWM_MENUCOMMAND:
caseWM_SYSCOMMAND:
caseWM_MOUSEACTIVATE:
caseWM_ENTERMENULOOP:
caseWM_HSCROLL:
caseWM_VSCROLL:
TRACE(_T("potentialterminatingmessage0x%X/n"),message);
if(m_bInit&&IsWindow(m_hWnd)&&IsWindow(m_hWndBalloon))
{
//removetipfromscreen
Destroy();
}
return0;
break;
};
if(hWnd==m_hParent)
{
if(m_wndProc&&IsWindow(m_hParent))
return(*m_wndProc)(hWnd,message,wParam,lParam);
else
return0;
}
else
{
if(IsWindow(hWnd))
return::DefWindowProc(hWnd,message,wParam,lParam);
else
return0;
}
}
//=============================================================================
//
//GetEnableBalloonTips()
//
//Purpose:TheGetEnableBalloonTips()functionretrievesthevalueof
//theregistrykeyEnableBalloonTips.
//
//Parameters:None
//
//Returns:BOOL-TRUE=keyvalueisnon-zero,orkeydoesnotexist;
//FALSE=keyvalueiszero.
//
BOOLCXBalloonMsg::GetEnableBalloonTips()
{
BOOLrc=TRUE;//assumeballoontipsareenabled
HKEYhkey=0;
if(RegOpenKeyEx(HKEY_CURRENT_USER,
_T("Software//Microsoft//Windows//CurrentVersion//Explorer//Advanced"),
0,KEY_QUERY_VALUE,&hkey)==ERROR_SUCCESS)
{
DWORDdwEnable=0;
DWORDdwSize=sizeof(DWORD);
if(RegQueryValueEx(hkey,_T("EnableBalloonTips"),0,0,
(LPBYTE)&dwEnable,&dwSize)==ERROR_SUCCESS)
{
rc=dwEnable!=0;
}
RegCloseKey(hkey);
}
returnrc;
}
//=============================================================================
//
//GetStrings()
//
//Purpose:TheGetStrings()functionsetstheclassvariablesm_szMsg
//andm_szTitle.
//
//Parameters:lpszTitle-[in]pointertotitlestringorresourceid;may
//beNULLorspecialsymbolLPCTSTR_DEFAULT_TITLE.
//lpszMsg-[in]pointertomessagestringorresourceid;
//mustnotbeNULL.
//hInstance-[in]appinstancehandle
//
//Returns:None
//
voidCXBalloonMsg::GetStrings(LPCTSTRlpszTitle,LPCTSTRlpszMsg,HINSTANCEhInstance)
{
//getmessageandtitle-theymaybepointerstostringsorresourceIDs
memset(m_szMsg,0,sizeof(m_szMsg));
memset(m_szTitle,0,sizeof(m_szTitle));
//isthemessageastringoraresourceid?
if(HIWORD(lpszMsg)==0)
{
//id
UINTnID=LOWORD((UINT)(UINT_PTR)lpszMsg);
if(!::LoadString(hInstance,nID,m_szMsg,sizeof(m_szMsg)/sizeof(TCHAR)-2))
{
TRACE(_T("ERROR-failedtoloadmessagestring%d/n"),nID);
_ASSERTE(FALSE);
}
}
else
{
//string
_tcsncpy(m_szMsg,lpszMsg,sizeof(m_szMsg)/sizeof(TCHAR)-2);
}
#ifdef_DEBUG
size_tnLen=_tcslen(m_szMsg);
size_tnBufLen=sizeof(m_szMsg)/sizeof(TCHAR);
if(nLen>(nBufLen-nBufLen/10))
{
TRACE(_T("WARNING-messagesizenearmaximumof%d/n"),nBufLen);
}
#endif
if(lpszTitle==LPCTSTR_DEFAULT_TITLE)
{//默认标题是模块名称
//settitletomodulename
_tcsncpy(m_szTitle,GetModuleName(hInstance),
sizeof(m_szTitle)/sizeof(TCHAR)-2);
}
elseif(lpszTitle)//titleisoptional
{
//isthetitleastringoranid?
if(HIWORD(lpszTitle)==0)
{
//id
UINTnID=LOWORD((UINT)(UINT_PTR)lpszTitle);
if(!::LoadString(hInstance,nID,m_szTitle,sizeof(m_szTitle)/sizeof(TCHAR)-2))
{
TRACE(_T("ERROR-failedtoloadtitlestring%d/n"),nID);
_ASSERTE(FALSE);
}
}
else
{
//string
_tcsncpy(m_szTitle,lpszTitle,sizeof(m_szTitle)/sizeof(TCHAR)-2);
}
}
#ifdef_DEBUG
nLen=_tcslen(m_szTitle);
nBufLen=sizeof(m_szTitle)/sizeof(TCHAR);
if(nLen>(nBufLen-nBufLen/10))
{
TRACE(_T("WARNING-titlesizenearmaximumof%d/n"),nBufLen);
}
#endif
}
//=============================================================================
//
//GetModuleName()
//
//Purpose:TheGetModuleName()functionreturnstheexecutablemodule
//name.
//
//Parameters:hInstance-[in]appinstancehandle
//
//Returns:TCHAR*-pointertoname(static)
//
TCHAR*CXBalloonMsg::GetModuleName(HINSTANCEhInstance)
{
staticTCHARszName[MAX_PATH*2];
szName[0]=_T('/0');
::GetModuleFileName(hInstance,szName,sizeof(szName)/sizeof(TCHAR)-2);
szName[sizeof(szName)/sizeof(TCHAR)-1]=_T('/0');
TCHAR*cp=_tcsrchr(szName,_T('//'));
if(cp)
{
_tcscpy(&szName[0],cp+1);
}
cp=_tcsrchr(szName,_T('.'));
if(cp)
{
*cp=_T('/0');
}
returnszName;
}
//=============================================================================
//
//PositionBalloon()
//
//Purpose:ThePositionBalloon()functionreturnstherectforthe
//messageballoon.
//
//Parameters:pRect-[in]optionalpointertocaller-specifiedRECT;
//maybeNULL.
//pNewRect-[out]pointertoRECTthatreceivesballoon
//location(leftandtopvaluesonlyarevaild).
//bBalloon-[in]TRUE=balloonwillbedisplayed;
//FALSE=regulartooltipwillbedisplayed.
//
//Returns:None
//
voidCXBalloonMsg::PositionBalloon(LPRECTpRect,LPRECTpNewRect,BOOLbBalloon)
{
RECTrect={0};
if(pRect)
{
//usespecifiedposition
rect=*pRect;
}
else
{
//usecontrolposition
RECTrectCtrl={0};
if(IsWindow(m_hCtrl))
::GetWindowRect(m_hCtrl,&rectCtrl);
rect=rectCtrl;
rect.top=rectCtrl.bottom;
if(bBalloon)
{
rect.left=rectCtrl.left+(rectCtrl.right-rectCtrl.left)/2;
rect.top=rectCtrl.top+(rectCtrl.bottom-rectCtrl.top)/2;
}
}
_ASSERTE(pNewRect);
if(pNewRect)
*pNewRect=rect;
}
显示API详解
Show函数创建,显示并操作一个气泡状的消息对话框。这个消息对话框包含一个消息字段和标题,一个关闭按钮,和一个可选的图标。
void Show(
LPCTSTR lpszTitle,
LPCTSTR lpszMsg,
HWND hCtrl,
HWND hParent,
HINSTANCE hInstance,
UINT nIcon = TTI_INFO,
BOOL bUseBalloonTips = TRUE,
UINT nTimeOutSeconds = 0,
LPRECT pRect = NULL
);
Parameters
lpszTitle
[in] Pointer to a null-terminated string that contains the balloon message title. If this parameter is NULL, no title and no icon will be displayed. The special symbol LPCTSTR_DEFAULT_TITLE may be used; it will cause the executable module name to be displayed.
lpszMsg
[in] Pointer to a null-terminated string that contains the balloon message to be displayed. Must not be null. Text callbacks (LPSTR_TEXTCALLBACK
) are not used, so the text string can be as long as you want, up to the size of the internal text buffer m_szMsg
.
hCtrl
[in] Handle to the control that the message is being displayed for. Must not be null.
hParent
[in] Handle to the parent window of the control. Must not be null.
hInstance
[in] Handle to the instance of the module that contains the string resource. May be null if string resource is not used.
nIcon
[in] Specifies the icon to associate with the balloon message. This can be one of the following values:
Value |
Meaning |
TTI_ERROR |
Use the error icon |
TTI_INFO |
Use the information icon |
TTI_NONE |
Use no icon |
TTI_WARNING |
Use the warning icon |
This parameter may also be the handle of an icon obtained from LoadIcon or LoadImage functions. If not present, this parameter defaults to TTI_INFO.
bUseBalloonTips
[in] Specifies whether balloon tips are to be used to display the message. If this parameter is TRUE, balloon tips will be used unless disabled in the registry. If this parameter is FALSE, regular tooltips will be used, regardless of value of registry key. If not present, this parameter defaults to TRUE.
nTimeOutSeconds
[in] Specifies the number of seconds before the balloon message is automatically closed. If this parameter is zero, the balloon message will not be automatically closed. If not present, this parameter defaults to zero.
pRect
[in] Pointer to a RECT struct that contains position where balloon message is to be displayed. May be null if default position should be used. If not present, this parameter defaults to null.
相关推荐
音视频-编解码-有限元方法主动模型气球Balloon在医学图像分割中的应用.pdf
ceshishuomingdsbfandfkmvlsdvc
上载一份个人修改的linux系统上Xen balloon的驱动程序,欢迎下载
Spring框架5源码研读分析 :fire:下载源码【Spring源码已经经过了处理,】 # 如果你想要一个干净的源码环境,请clone init分支 ...# 如果你的网比较好,也可以clone github上面的仓库 ...在中导入spring5 spring-core生成...
作业-棒球 개요 본棒球游戏研究室은 간 단 한 숫 자 맞 추 기 게 임 입 니 다 。 3个随机数和随机数在Strike和Ball上进行下载。 。다음과같습니다。 Str Str Str Str Str가1 Strike Ball르나Ball 1球 ...
Balloon -
vue-balloon Vue.js插件可创建一个浮动元素,该元素在单击时会扩展。 在此处查看示例。 相关性此插件使用aweso vue-balloon Vue.js字体插件创建一个浮动元素,该...npm install vue-balloon-保存或纱线添加vue-balloon
mask-rcnn-balloon.h5文件
SmartBot 带有Angular 5和DialogFlowChatBot跑ng serve确保使用您自己的DialogFlow客户端访问令牌更新environment / environment.ts。进一步的帮助
Train on the toy Balloon dataset and implement color splash effect. Copyright (c) 2018 Matterport, Inc. Licensed under the MIT License (see LICENSE for details) Written by Waleed Abdulla
Notifu is a tool that displays a yellow pop-up balloon in the system notification area, better known as the tray. It is free and open source, give it a try!
采用mobilenet_v1替换原作者采用的resnet50,对于coco2014数据集进行重新训练,迭代了160k次,最终得到的模型模型大小为93m,原模型270多m,同时运算速度大大的提升了,感兴趣的同学可以去下载一下,不用gpu,可以直接...
信息 进行中的项目:建立神经网络以学习个人的说话风格并以他们的方式做出回应。 当前状态:过去一年对我的iMessage进行了培训(其中很多是和我妈妈在一起的)。 在逐个字母的邮件生成中,精度约为60% 。...
Mask R-CNN 2.1#The Balloon weights
Ajax-jquery.mb.balloon.zip,向任何元素添加气球提示的jquery插件;内容可以是简单的字符串、dom元素或ajax内容。,ajax代表异步javascript和xml。它是多种web技术的集合,包括html、css、json、xml和javascript。它...
IOS应用源码之andresbonilla-Balloon-Pop-Fever-42b8b8d.zip
TOAST UI SelectBox 应用 Google Analytics (GA) 收集有关开源使用的统计数据,以确定 TOAST UI SelectBox 在全球的使用范围。 也是决定项目未来走向的重要指标。 location.hostname (例如>“ui.toast.com”)将被...
hot-air-balloon
前端项目-balloon-css,Simple tooltips made of pure CSS
iOS游戏应用源代码——andresbonilla-Balloon-Pop-Fever.zip