資源簡(jiǎn)介
Windows下屏幕抓取軟件,可以抓取任何屏幕上的內(nèi)容,可以保存為Avi文件。每秒幀數(shù)可以設(shè)置,不丟幀。附源代碼。

代碼片段和文件信息
//---------------------------------------------------------------------------
#pragma?hdrstop
#include?“Avi.h“
#pragma?package(smart_init)
#define?STRICT
#define?WIN32_LEAN_AND_MEAN
#include?
#include?
//#include?“win32_LastError.h“
#include?
//---------------------------------------------------------------------------
AviBitmap::AviBitmap()?:?bitmap_(0)?{}
AviBitmap::AviBitmap(std::string?const&?file_name)?{
??bitmap_?=?static_cast(::LoadImage(0?file_name.c_str()?IMAGE_BITMAP00LR_LOADFROMFILE|LR_CREATEDIBSECTION));
}
AviBitmap::AviBitmap(HBITMAP?bmp)?:?bitmap_(bmp)?{
}
AviBitmap::operator?HBITMAP()?const?{
??return?bitmap_;
}
//?First?we‘ll?define?the?WAV?file?format.
#include?
#pragma?pack(2)
struct?FmtChunk?{
??char?id[4];????????????//=“fmt?“
??unsigned?long?size;????//=16
??short?wFormatTag;???????//=WAVE_FORMAT_PCM=1
??unsigned?short?wChannels;????????//=1?or?2?for?mono?or?stereo
??unsigned?long??dwSamplesPerSec;??//=11025?or?22050?or?44100
??unsigned?long??dwAvgBytesPerSec;?//=wBlockAlign?*?dwSamplesPerSec
??unsigned?short?wBlockAlign;??????//=wChannels?*?(wBitsPerSample==8?1:2)
??unsigned?short?wBitsPerSample;???//=8?or?16?for?bits?per?sample
//??char??what[14];//14字節(jié)含義???
};
struct??FactChunk{?//
??char?id[4];???//fact
??unsigned?long?size;
??char?data[4];
};
struct?DataChunk?{
??char?id[4];???//=“data“
??unsigned?long?size;????//=datsize?size?of?the?following?array
??unsigned?char?data[1];?//=the?raw?data?goes?here
};
struct?WavChunk?{
???????????char?id[4];???//=“RIFF“
??unsigned?long?size;????//=datsize+8+16+4
???????????char?type[4];?//=“WAVE“
??FmtChunk??????fmt;
??DataChunk?????dat;
};
#include?
struct?TAviUtil?{
??IAVIFile*?????pfile;?????????//?created?by?CreateAvi
??WAVEFORMATEX??wfx;???????????//?as?given?to?CreateAvi?(.nChanels=0?if?none?was?given).?Used?when?audio?stream?is?first?created.
??int???????????period;????????//?specified?in?CreateAvi?used?when?the?video?stream?is?first?created
??IAVIStream*???as;????????????//?audio?stream?initialised?when?audio?stream?is?first?created
??IAVIStream*???ps;
??IAVIStream*???psCompressed;??//?video?stream?when?first?created
??unsigned?long?nframe?nsamp;?//?which?frame?will?be?added?next?which?sample?will?be?added?next
??bool??????????iserr;?????????//?if?true?then?no?function?will?do?anything
};
#pragma?pack(8)
Avi::Avi(AnsiString?file_name?int?frame_period?const?WAVEFORMATEX*?wfx)?{
??IAVIFile?*pfile;
??::AVIFileInit();
??HRESULT?hr?=?::AVIFileOpen(&pfile?file_name.c_str()?OF_WRITE|OF_CREATE?0);
??if?(hr?!=?AVIERR_OK)?{
????::AVIFileExit();
????throw?“AVIERR_OK“;
??}
??TAviUtil?*au?=?new?TAviUtil;
??au->pfile?=?pfile;
??if?(wfx==0)?::ZeroMemory(&au->wfxsizeof(WAVEFORMATEX));?else?::CopyMemory(&au->wfxwfxsizeof(WAVEFORMATEX));
??au->period?=?frame_period;
??au->as=0;
??au->ps=0;
??au->psCompressed=0;
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????1020??2005-11-13?22:08??Sample.cpp
?????文件???????5025??2006-01-15?15:33??Sample.dsk
?????文件????????113??2016-11-22?22:07??Sample.ini
?????文件??????17992??2006-01-10?11:16??Sample.obj
?????文件???????3372??2005-12-14?14:42??Sample.res
?????文件????4063232??2006-01-10?11:17??Sample.tds
?????文件???????1878??2005-09-13?21:48??SampleWindow.cpp
?????文件?????????51??2005-09-13?21:48??SampleWindow.ddp
?????文件????????769??2005-09-13?21:36??SampleWindow.dfm
?????文件???????1226??2005-09-13?21:36??SampleWindow.h
?????文件??????20428??2006-01-15?17:00??SampleWindow.obj
?????文件??????16148??2005-11-15?14:17??Avi.cpp
?????文件???????1050??2005-11-14?23:43??Avi.h
?????文件?????149030??2006-01-10?11:16??Avi.obj
?????文件??????13573??2005-12-19?13:09??Sam.cpp
?????文件?????????51??2005-12-21?23:18??Sam.ddp
?????文件?????164543??2005-12-21?23:18??Sam.dfm
?????文件???????3841??2005-11-25?10:52??Sam.h
?????文件?????346076??2006-01-10?11:16??Sam.obj
?????文件???????9511??2005-09-11?16:37??Sam1.cpp
?????文件???????4037??2005-12-14?14:42??Sample.bpr
-----------?---------??----------?-----??----
??????????????4822966????????????????????21
- 上一篇:新安江模型修改
- 下一篇:vc++能夠顯示網(wǎng)頁html
評(píng)論
共有 條評(píng)論