资源简介
USB识别 HID识别 MFC代码
代码片段和文件信息
// 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 2012-02-10 10:03 testusb\
目录 0 2016-08-10 15:59 testusb\testUSB\
文件 173 2012-01-21 19:37 testusb\testUSB\copyright.bat
目录 0 2016-08-10 15:53 testusb\testUSB\Debug\
文件 40991 2016-08-10 15:53 testusb\testUSB\Debug\ScrollerCtrl.obj
文件 0 2016-08-10 15:53 testusb\testUSB\Debug\ScrollerCtrl.sbr
文件 124178 2016-08-10 15:53 testusb\testUSB\Debug\StdAfx.obj
文件 1494142 2016-08-10 15:53 testusb\testUSB\Debug\StdAfx.sbr
文件 3408896 2016-08-10 15:53 testusb\testUSB\Debug\testUSB.bsc
文件 131153 2016-08-10 15:53 testusb\testUSB\Debug\testUSB.exe
文件 326620 2016-08-10 15:53 testusb\testUSB\Debug\testUSB.ilk
文件 14020 2016-08-10 15:53 testusb\testUSB\Debug\testUSB.obj
文件 7570352 2016-08-10 15:53 testusb\testUSB\Debug\testUSB.pch
文件 484352 2016-08-10 15:53 testusb\testUSB\Debug\testUSB.pdb
文件 2088 2016-08-10 15:53 testusb\testUSB\Debug\testUSB.res
文件 0 2016-08-10 15:53 testusb\testUSB\Debug\testUSB.sbr
文件 74682 2016-08-10 15:53 testusb\testUSB\Debug\testUSBDlg.obj
文件 0 2016-08-10 15:53 testusb\testUSB\Debug\testUSBDlg.sbr
文件 230400 2016-08-10 15:59 testusb\testUSB\Debug\vc60.idb
文件 413696 2016-08-10 15:53 testusb\testUSB\Debug\vc60.pdb
文件 5235 2014-06-28 01:00 testusb\testUSB\devioctl.h
文件 12384 2001-08-17 12:39 testusb\testUSB\hid.lib
文件 80543 2001-08-17 14:12 testusb\testUSB\hidpi.h
文件 14593 2014-06-28 01:00 testusb\testUSB\hidsdi.h
文件 11066 2014-06-28 01:00 testusb\testUSB\hidusage.h
文件 3597 2004-10-28 18:55 testusb\testUSB\ReadMe.txt
目录 0 2004-11-04 21:59 testusb\testUSB\res\
文件 869 2016-08-10 15:52 testusb\testUSB\resource.h
文件 766 2004-10-28 21:45 testusb\testUSB\res\testUSB.ico
文件 399 2004-10-28 18:55 testusb\testUSB\res\testUSB.rc2
文件 15767 2004-08-21 16:22 testusb\testUSB\ScrollerCtrl.cpp
............此处省略20个文件信息
- 上一篇:俄罗斯方块源码用VC开发
- 下一篇:VC++ MFC 串口通信20个经典源码合集
评论
共有 条评论