資源簡介
USB鍵盤類 C 讀寫源碼
代碼片段和文件信息
//?CScrollerCtrl?:?class?implementation
//?Copyright?2002?Joshua?Heyer
//??You?are?free?to?use?this?code?for?whatever?you?want?provided?you
//?give?credit?where?credit?is?due:?if?you?use?this?code?without?substantial
//?modification?please?presearve?this?comment?block.
//??I‘m?providing?this?code?in?the?hope?that?it?is?useful?to?someone?as?i?have
//?gotten?much?use?out?of?other?peoples?code?over?the?years.
//??If?you?see?value?in?it?make?some?improvements?etc.?i?would?appreciate?it?
//?if?you?sent?me?some?feedback.
//??Have?fun!
//
#include?“stdafx.h“
#include?“ScrollerCtrl.h“
//?command?messages:
//?sent?when?text?has?scrolled?completely?off?the?window
const?int???CScrollerCtrl::SC_SCROLL_COMPLETE?=?0;
//?defaults
const?int???CScrollerCtrl::nSCROLL_DELAY??=?80;????//?time?between?each?frame?(milliseconds)
const?int???CScrollerCtrl::nSCROLL_PAUSE??=?5000;??//?time?to?pause?before?autoscrolling?(milliseconds)
const?int???CScrollerCtrl::nMARGIN????????=?5;?????//?(pixels)
const?int???CScrollerCtrl::nFONT_SIZE?????=?12;????//?(points)
const?int???CScrollerCtrl::nFONT_WEIGHT???=?FW_SEMIBOLD;
const?char*?CScrollerCtrl::szFONT_NAME????=?“Comic?Sans?MS“;
//?initialization
CScrollerCtrl::CScrollerCtrl()
{
m_crBackground???=?RGB(000);
m_crForeground???=?RGB(255255255);
???m_pbmpPattern?????=?NULL;
m_pbmpLogo????????=?NULL;
m_nContentHeight??=?0;
m_nScrollOffset???=?0;
???m_unTimerPause????=?2;
???m_nScrollDelay????=?nSCROLL_DELAY;
???m_nScrollPause????=?nSCROLL_PAUSE;
???m_eState??????????=?PAUSED;
???m_bTilePattern????=?TRUE;
???m_bShowScroll?????=?FALSE;
???m_bWrap???????????=?TRUE;
m_sizeBuffer??????=?CSize(00);
}
//?create?the?window:?
//????remove?WS_VSCROLL?to?avoid?showing?scrollbar.
//????remove?WS_TABSTOP?to?disable?keyboard?scrolling.
BOOL?CScrollerCtrl::Create(const?RECT&?rect?CWnd*?pParentWnd?UINT?ustyle?UINT?nID)
{
???if?(?NULL?==?m_font.GetSafeHandle()?)
??????SetFont(szFONT_NAME?nFONT_SIZE?nFONT_WEIGHT);
???//?remember?if?user?specified?the?style?but?don‘t?show?initially
???m_bShowScroll?=?ustyle&WS_VSCROLL;
???ustyle?&=?~WS_VSCROLL;
if?(?CWnd::Create(::AfxRegisterWndClass(CS_HREDRAW|CS_PARENTDC|CS_VREDRAW::LoadCursor(NULLIDC_ARROW))?“Scroller“?ustyle?rect?pParentWnd?nID)?)
{
??????m_eState?=?PAUSED;
??????SetTimer(1?m_nScrollDelay?NULL);
m_unTimerPause?=?SetTimer(m_unTimerPause?m_nScrollPause?NULL);
return?TRUE;
}
return?FALSE;
}
//?activate/deactivate?wrapping?mode:
//?if?not?set?content?is?scrolled?completely?off?screen
//?before?being?repeated.
void?CScrollerCtrl::SetWrapping(BOOL?bWrap)
{
???m_bWrap?=?bWrap;
???if?(?NULL?!=?m_hWnd?)
??????Invalidate(FALSE);
}
//?Sets?the?color?used?for?the?background?(if?no?pattern?is?set)?
//?or?margins?(if?pattern?is?set?and?not?tiled)
void?CScrollerCtrl::SetBgColor(COLORREF?clrBg)
{
???m_crBackground?=?clrBg;
???if?(?NULL?!=?m_hWnd?)
??????Invalidate(FALSE);
}
//?Sets?the
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2020-05-01?14:55??VC6_USB_Demo\
?????目錄???????????0??2020-04-29?17:16??VC6_USB_Demo\Debug\
?????文件???????41177??2020-04-27?11:50??VC6_USB_Demo\Debug\ScrollerCtrl.obj
?????文件???????????0??2020-04-27?11:50??VC6_USB_Demo\Debug\ScrollerCtrl.sbr
?????文件??????124670??2020-04-27?11:50??VC6_USB_Demo\Debug\StdAfx.obj
?????文件?????1494338??2020-04-27?11:50??VC6_USB_Demo\Debug\StdAfx.sbr
?????文件?????3449856??2020-04-29?17:16??VC6_USB_Demo\Debug\testUSB.bsc
?????文件??????131143??2020-04-29?17:16??VC6_USB_Demo\Debug\testUSB.exe
?????文件??????305296??2020-04-29?17:16??VC6_USB_Demo\Debug\testUSB.ilk
?????文件???????14196??2020-04-27?11:50??VC6_USB_Demo\Debug\testUSB.obj
?????文件?????7637316??2020-04-27?11:50??VC6_USB_Demo\Debug\testUSB.pch
?????文件??????500736??2020-04-29?17:16??VC6_USB_Demo\Debug\testUSB.pdb
?????文件????????2088??2020-04-27?11:46??VC6_USB_Demo\Debug\testUSB.res
?????文件???????????0??2020-04-27?11:50??VC6_USB_Demo\Debug\testUSB.sbr
?????文件???????74858??2020-04-29?17:16??VC6_USB_Demo\Debug\testUSBDlg.obj
?????文件???????????0??2020-04-29?17:16??VC6_USB_Demo\Debug\testUSBDlg.sbr
?????文件??????377856??2020-05-01?14:55??VC6_USB_Demo\Debug\vc60.idb
?????文件??????413696??2020-04-29?17:16??VC6_USB_Demo\Debug\vc60.pdb
?????文件????????5197??2001-08-17?14:12??VC6_USB_Demo\devioctl.h
?????文件???????12384??2001-08-17?12:39??VC6_USB_Demo\hid.lib
?????文件???????80543??2001-08-17?14:12??VC6_USB_Demo\hidpi.h
?????文件???????14555??2001-08-17?14:12??VC6_USB_Demo\hidsdi.h
?????文件???????11028??2001-08-17?14:12??VC6_USB_Demo\hidusage.h
?????文件????????3597??2004-10-28?18:55??VC6_USB_Demo\ReadMe.txt
?????目錄???????????0??2020-03-26?14:38??VC6_USB_Demo\Release\
?????文件???????36864??2004-10-31?21:47??VC6_USB_Demo\Release\testUSB.exe
?????目錄???????????0??2020-03-26?14:38??VC6_USB_Demo\res\
?????文件?????????823??2004-10-28?22:34??VC6_USB_Demo\Resource.h
?????文件?????????766??2004-10-28?21:45??VC6_USB_Demo\res\testUSB.ico
?????文件?????????399??2004-10-28?18:55??VC6_USB_Demo\res\testUSB.rc2
?????文件???????15767??2004-08-21?16:22??VC6_USB_Demo\ScrollerCtrl.cpp
............此處省略22個文件信息
評論
共有 條評論