-
大小: 26.62MB文件類型: .rar金幣: 1下載: 0 次發布日期: 2023-06-21
- 語言: C/C++
- 標簽:
資源簡介
pdf+源代碼,親測可用,基于vc6.0編譯
代碼片段和文件信息
#include?
#include?????/*?_beginthread?_endthread?*/
#include?
#include?
#include?
#include?
void?Bounce(?void?*ch?);
void?CheckKey(?void?*dummy?);
/*?GetRandom?returns?a?random?integer?between?min?and?max.?*/
#define?GetRandom(?min?max?)?((rand()?%?(int)(((max)?+?1)?-?(min)))?+?(min))
BOOL?repeat?=?TRUE;?????/*?Global?repeat?flag?and?video?variable?*/
HANDLE?hStdOut;?????????/*?Handle?for?console?window?*/
CONSOLE_SCREEN_BUFFER_INFO?csbi;????/*?Console?information?structure?*/
void?main()
{
????CHAR????ch?=?‘A‘;
????hStdOut?=?GetStdHandle(?STD_OUTPUT_HANDLE?);
????/*?Get?display?screen‘s?text?row?and?column?information.?*/
???GetConsoleScreenBufferInfo(?hStdOut?&csbi?);
????/*?Launch?CheckKey?thread?to?check?for?terminating?keystroke.此線程用來控制線程和程序的終止?*/
????_beginthread(?CheckKey?0?NULL?);
????/*?Loop?until?CheckKey?terminates?program.?*/
????while(?repeat?)
????{
????????/*?On?first?loops?launch?character?threads.?*/
????????_beginthread(?Bounce?0?(void?*)?(ch++)??);
//不斷啟動新的線程
????????/*?Wait?one?second?between?loops.?*/
????????Sleep(?1000L?);
????}
}
/*?CheckKey?-?Thread?to?wait?for?a?keystroke?then?clear?repeat?flag.?*/
void?CheckKey(?void?*dummy?)
{
????_getch();
????repeat?=?0;????/*?_endthread?implied?*/
}
/*?Bounce?-?Thread?to?create?and?and?control?a?colored?letter?that?moves
?*?around?on?the?screen.
?*
?*?Params:?ch?-?the?letter?to?be?moved
?*/
void?Bounce(?void?*ch?)
{
????/*?Generate?letter?and?color?attribute?from?thread?argument.?*/
????char????blankcell?=?0x20;
????char????blockcell?=?(char)?ch;
????BOOL????first?=?TRUE;
???COORD???oldcoord?newcoord;
???DWORD???result;
????
???/*?Seed?the?random-number?generator?with?current?time?so?that
??the?numbers?will?be?different?every?time?we?run.
????*/
srand(?(unsigned)time(?NULL?)?);
??
/*??get?initial?location.?*/
????newcoord.X?=?GetRandom(?0?csbi.dwSize.X?-?1?);
????newcoord.Y?=?GetRandom(?0?csbi.dwSize.Y?-?1?);
????while(?repeat?)
????{
????????/*?Pause?between?loops.?*/
Sleep(?100L?);
????????/*?Blank?out?our?old?position?on?the?screen?and?draw?new?letter.?*/
????????if(?first?)
????????????first?=?FALSE;
????????else
?????????WriteConsoleOutputCharacter(?hStdOut?&blankcell?1?oldcoord?&result?);
?????????WriteConsoleOutputCharacter(?hStdOut?&blockcell?1?newcoord?&result?);
????????/*?Increment?the?coordinate?for?next?placement?of?the?block.?*/
????????oldcoord.X?=?newcoord.X;
????????oldcoord.Y?=?newcoord.Y;
????????newcoord.X?+=?GetRandom(?-1?1?);
????????newcoord.Y?+=?GetRandom(?-1?1?);
????????/*?Correct?placement?(and?beep)?if?about?to?go?off?the?screen.?*/
????????if(?newcoord.X?0?)
????????????newcoord.X?=?1;
????????else?if(?newcoord.X?==?csbi.dwSize.X?)
????????????newcoord.X?=?csbi.dwSize.X?-?2;
????????else?if(?newcoord.Y?0?)
????????????newcoord.Y?=?1;
????????else?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???24947321??2016-03-02?15:03??Windows多線程編程技術與實例-源代碼\Windows多線程編程技術與實例.pdf
?????文件???????1369??2005-04-30?14:31??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\readme.txt
?????文件???????3348??2003-12-15?13:02??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第1節\MultiThread\multiThread.cpp
?????文件???????4105??2003-12-11?15:55??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第1節\MultiThread\MultiThread.dsp
?????文件????????547??2003-12-11?14:02??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第1節\MultiThread\MultiThread.dsw
?????文件??????41984??2003-12-23?08:04??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第1節\MultiThread\MultiThread.ncb
?????文件??????48640??2003-12-23?08:04??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第1節\MultiThread\MultiThread.opt
?????文件????????500??2003-12-15?13:04??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第1節\MultiThread\MultiThread.plg
?????文件???????3347??2003-12-08?17:40??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第1節\multThread.c
?????文件?????????61??2003-12-11?16:20??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第1節\readme.txt
?????文件???????3510??2003-12-19?04:57??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\animation.cpp
?????文件???????2235??2003-12-19?04:57??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\animation.h
?????文件??????21200??2004-07-02?23:54??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\CopyFile.aps
?????文件???????1332??2004-07-03?00:01??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\CopyFile.clw
?????文件???????2091??2003-12-15?14:45??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\CopyFile.cpp
?????文件???????4772??2003-12-19?10:31??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\CopyFile.dsp
?????文件????????583??2003-12-19?05:51??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\CopyFile.dsw
?????文件???????1346??2003-12-15?14:45??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\CopyFile.h
?????文件??????74752??2004-07-03?00:22??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\CopyFile.ncb
?????文件??????54784??2004-07-03?00:22??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\CopyFile.opt
?????文件???????1113??2003-12-20?01:26??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\CopyFile.plg
?????文件???????5948??2003-12-19?08:39??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\CopyFile.rc
?????文件???????7626??2003-12-20?01:26??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\CopyFileDlg.cpp
?????文件???????1478??2003-12-20?01:23??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\CopyFileDlg.h
?????文件???????4274??2003-12-19?08:39??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\DirDialog.cpp
?????文件????????694??2003-12-19?08:39??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\DirDialog.h
?????文件???????9484??1998-04-25?03:58??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\FILECOPY.AVI
?????文件???????3615??2003-12-15?14:45??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\ReadMe.txt
?????文件???????1078??2003-12-15?14:45??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\res\CopyFile.ico
?????文件????????400??2003-12-15?14:45??Windows多線程編程技術與實例-源代碼\《Windows多線程編程技術與實例》-郝文化-源代碼-3316\第2章\第2節\CopyFile1\res\CopyFile.rc2
............此處省略514個文件信息
- 上一篇:GB/T28181網絡攝像機模擬器源碼
- 下一篇:MFC控制攝像頭
評論
共有 條評論