-
大小: 6.67MB文件類型: .zip金幣: 2下載: 0 次發布日期: 2023-09-22
- 語言: 其他
- 標簽: _beginthread??多線程??
資源簡介
采用_beginthread創建多線程,創建盡可能多的線程,直到系統不能創建為止,創建數目實時動態顯示。

代碼片段和文件信息
//?Hyperlink.cpp?:?implementation?file
//
//?Hyperlink?static?control.
//
//?Copyright?(C)?1997?1998?Giancarlo?Iovino?(giancarlo@saria.com)
//?All?rights?reserved.?May?not?be?sold?for?profit.
//
//?This?code?is?based?on?CHyperlink?by?Chris?Maunder.
//?“GotoURL“?function?by?Stuart?Patterson?appeared?in?the?Aug?1997
//?Windows?Developer‘s?Journal.
//?“Default?hand?cursor“?from?Paul?DiLascia‘s?Jan?1998?MSJ?article.
#include?“stdafx.h“
#include?“Hyperlink.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CHyperlink
CHyperlink::CHyperlink()
{
m_bHot ???????? =?FALSE; //?Control?doesn‘t?own?the?focus?yet
m_strURL.Empty(); //?Set?URL?to?an?empty?string
m_clrHot?=?RGB(00255);
m_clrNor?=?RGB(00255);
m_clrBG?=?RGB(240240240);
}
CHyperlink::~CHyperlink()
{
}
IMPLEMENT_DYNAMIC(CHyperlink?CStatic)
BEGIN_MESSAGE_MAP(CHyperlink?CStatic)
????//{{AFX_MSG_MAP(CHyperlink)
????ON_WM_MOUSEMOVE()
ON_WM_LBUTTONUP()
ON_WM_PAINT()
ON_MESSAGE(WM_MOUSEHOVER&OnMouseHover)
????ON_MESSAGE(WM_MOUSELEAVE&onmouseleave)
ON_WM_SETCURSOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
void?CHyperlink::PreSubclassWindow()?
{
//?TODO:?Add?your?specialized?code?here?and/or?call?the?base?class
DWORD?dwstyle?=?Getstyle();
????::SetWindowLong(GetSafeHwnd()?GWL_style?dwstyle?|?SS_NOTIFY);
// SetFont(GetParent()->GetFont());
CStatic::PreSubclassWindow();
}
void?CHyperlink::onmousemove(UINT?nFlags?CPoint?point)?
{
TRACKMOUSEEVENT?tme;?
????tme.cbSize?=?sizeof(tme);?
????tme.hwndTrack?=?m_hWnd;?
????tme.dwFlags?=?TME_LEAVE?|?TME_HOVER;?
????tme.dwHoverTime?=??1;?
????_TrackMouseEvent(&tme);?
??//??CStatic::onmousemove(nFlags?point);
}
//鼠標在上面
LRESULT?CHyperlink::OnMouseHover(WPARAM?wParamLPARAM?lParam)
{
if?(!m_bHot)
{
m_bHot?=?TRUE;?
????Invalidate();
}??
return?TRUE;
}
//鼠標離開
LRESULT?CHyperlink::onmouseleave(WPARAM?wParamLPARAM?lParam)
{
m_bHot?=?FALSE;
Invalidate();
return?TRUE;
}
void?CHyperlink::OnLButtonUp(UINT?nFlags?CPoint?point)?
{
if?(m_strURL.IsEmpty())
{
GetWindowText(m_strURL);
}
GotoURL(m_strURL?SW_SHOW);
}
/////////////////////////////////////////////////////////////////////////////
//?CHyperlink?operations
void?CHyperlink::SetURL(CString?strURL)
{
m_strURL?=?strURL;
}
CString?CHyperlink::GetURL()?const?
{?
return?m_strURL;???
}
int?CHyperlink::GotoURL(LPCTSTR?url?int?showcmd)
{
????HINSTANCE?result?=?ShellExecute(NULL?_T(“open“)?url?NULLNULL?showcmd);?
return?(int)result;
}
void?CHyperlink::OnPaint()?
{
CPaintDC?dc(this);?//?device?context?for?painting
//?TODO:?Add?your?message?handler?code?here
????CFont*?pFont?=?GetFont();
CFont?m_Font;
if?(pFont?!=?NULL)
{
LOG
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-12-18?17:13??_beginthread\
?????文件????????4202??2012-07-19?00:01??_beginthread\Hyperli
?????文件????????2258??2011-11-16?13:49??_beginthread\Hyperli
?????文件????????2827??2012-12-18?13:53??_beginthread\ReadMe.txt
?????文件??????105188??2012-12-18?17:12??_beginthread\_beginthread.aps
?????文件????????1731??2012-12-18?13:53??_beginthread\_beginthread.cpp
?????文件?????????481??2012-12-18?13:53??_beginthread\_beginthread.h
?????文件????22547456??2012-12-18?17:13??_beginthread\_beginthread.ncb
?????文件????????5439??2012-12-18?17:12??_beginthread\_beginthread.rc
?????文件????????4608??2012-12-18?17:13??_beginthread\_beginthread.suo
?????文件????????5660??2012-12-18?17:12??_beginthread\_beginthread.vcproj
?????文件????????1409??2012-12-18?17:12??_beginthread\_beginthread.vcproj.new-PC.new.user
?????文件????????4362??2012-12-18?17:13??_beginthread\_beginthreadDlg.cpp
?????文件?????????881??2012-12-18?17:12??_beginthread\_beginthreadDlg.h
?????目錄???????????0??2012-12-18?13:53??_beginthread\res\
?????文件???????67777??2007-11-28?16:21??_beginthread\res\_beginthread.ico
?????文件?????????368??2012-12-18?13:53??_beginthread\res\_beginthread.rc2
?????文件?????????822??2012-12-18?17:12??_beginthread\resource.h
?????文件?????????145??2012-12-18?13:53??_beginthread\stdafx.cpp
?????文件????????1879??2012-12-18?15:49??_beginthread\stdafx.h
?????文件????????1030??2012-12-18?13:53??_beginthread\targetver.h
評論
共有 條評論