用键盘keybd_event模拟PrintScreen键
解决方案 »
- 如何高效干净地弹出盘符
- 关于CFileDialog的使用问题
- 怎样保存DC里的内容?
- CoCreateInstance
- 在线等待:如何在鼠标点击一个CListCtrl的列表项的Check方框时获得鼠标的点击消息?
- 关于经度纬度的问题!谢谢,急!
- 100分急切期盼ADO错误--runtime error!!
- A dialog application: VC ->View ->ClassWizard ->(Ctrl + W)Object IDs只显示CDialog name, 为什么没有显示ID的列表
- 哪个大学的计算机专业最好?(本科和研究生)
- 在API函数前面加一个::是什么意思?
- 我有一段程序是显示一个窗口的,但我不知道怎么样才能在窗口里显示一行字啊,谁能帮我?
- 高分求Jpeg压缩显示代码
{ HWND hWnd = (HWND)0 ; HDC hDC = ::GetDC( hWnd ) ;
HWND hWork ;
RECT rectTaskBar ;
int iX = 0 ;
int iY = 0 ;
int iWidth = 0 ;
int iHeight = 0 ;
switch( iType )
{
case CAPTURE_RECT : // 儐乕僓巜掕嬮宍椞堟
iX = (*pRect).left ;
iY = (*pRect).top ;
iWidth =(*pRect).right - (*pRect).left ;
iHeight =(*pRect).bottom - (*pRect).top ;
break ;
case CAPTURE_CLIENT : // 僋儔僀傾儞僩椞堟(僫價僎乕僔儑儞僶乕丒僐儅儞僪僶乕晹暘傪彍偔)
::ReleaseDC( hWnd, hDC ) ;
hWnd = ::GetDesktopWindow() ;
hDC = ::GetDC( hWnd ) ;
::GetWindowRect( hWnd, pRect ) ;
if( (hWork = ::FindWindow( _T("HHTaskBar"), NULL)) )
{
::GetWindowRect( hWork, &rectTaskBar ) ;
pRect->bottom -= (rectTaskBar.bottom - rectTaskBar.top) ;
}
iX = 0 ;
iY = 0 ;
iWidth = pRect->right - pRect->left ;
iHeight = pRect->bottom - pRect->top ;
break ;
case CAPTURE_DESKTOP : // 夋柺慡懱
default :
iX = 0 ;
iY = 0 ;
iWidth = GetDeviceCaps( hDC, HORZRES ) ;
iHeight = GetDeviceCaps( hDC, VERTRES ) ;
break ;
} *phBitmap = CreateCompatibleBitmap( hDC, iWidth, iHeight ) ;
if( !(*phBitmap) )
{
::ReleaseDC( hWnd, hDC ) ;
return( FALSE ) ;
} // DSP儊儌儕 僨僶僀僗僐儞僥僉僗僩嶌惉
HDC hmemDC ;
hmemDC = CreateCompatibleDC( hDC ) ; HBITMAP hOldBitmap ;
hOldBitmap = (HBITMAP)SelectObject( hmemDC, *phBitmap ) ; // 價僢僩儅僢僾暋幨
BitBlt( hmemDC,0, 0, iWidth, iHeight, hDC, iX, iY , SRCCOPY ) ; SelectObject( hmemDC, hOldBitmap ) ;
DeleteDC( hmemDC ) ;
// 僉儍僾僠儍僒僀僘僙僢僩
pRect->left = 0 ;
pRect->top = 0 ;
pRect->right = iWidth ;
pRect->bottom = iHeight ; ::ReleaseDC( hWnd, hDC ) ;
return( TRUE ) ;
}