亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? lion-tutorial16.htm

?? 內有一些代碼
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
<html>

<head>
<link rel="stylesheet" href="../../asm.css">

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Iczelion's win32 asm tutorial</title>
</head>

<body bgcolor="#FFFFFF" background="../../images/back01.jpg">
<p align="center">Tutorial 16: Event Object</p>
<hr size="1">
<strong> </strong> We will learn what an event object is and how to use it in 
a multithreaded program. 
<p>Download the example <a href="files/tut16.zip">here</a>. 
<h3> Theory:</h3>
From the previous tutorial, I demonstrated how threads communicate with a custom 
window message. I left out two other methods: global variable and event object. 
We will use both of them in this tutorial. <br>
An event object is like a switch: it has only two states: on or off. When an event 
object is turned on, it's in the "signalled" state. When it is turned off, it's 
in the "nonsignalled" state. You create an event object and put in a code snippet 
in the relevant threads to watch for the state of the event object. If the event 
object is in the nonsignalled state, the threads that wait for it will be asleep.When 
the threads are in wait state, they consume little CPU time. <br>
You create an event object by calling CreateEvent function which has the following 
syntax: 
<p><b>CreateEvent proto lpEventAttributes:DWORD,\</b> <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  bManualReset:DWORD,\</b> <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  bInitialState:DWORD,\</b> <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  lpName:DWORD</b> 
<p><b>lpEventAttribute</b>--> If you specify NULL value, the event object is created 
  with default security descriptor. <br>
  <b>bManualReset</b>--> If you want Windows to automatically reset the event 
  object to nonsignalled state after WaitForSingleObject call, you must specify 
  FALSE as this parameter. Else you must manually reset the event object with 
  the call to ResetEvent. <br>
  <b>bInitialState</b>--> If you want the event object to be created in the signalled 
  state, specify TRUE as this parameter else the event object will be created 
  in the nonsignalled state. <br>
  <b>lpName</b> --> Pointer to an ASCIIZ string that is the name of the event 
  object. This name is used when you want to call OpenEvent. 
<p>If the call is successful, it returns the handle to the newly created event 
  object else it returns NULL. <br>
  You can modify the state of an event object with two API calls: SetEvent and 
  ResetEvent. SetEvent function sets the event object into signalled state. ResetEvent 
  does the reverse. <br>
  When the event object is created, you must put the call to WaitForSingleObject 
  in the thread that wants to watch for the state of the event object. WaitForSingleObject 
  has the following syntax: 
<p><b>WaitForSingleObject proto hObject:DWORD, dwTimeout:DWORD</b> 
<p><b>hObject</b> --> A handle to one of the synchronization object. Event object 
  is a type of synchronization object. <br>
  <b>dwTimeout </b>--> specify the time in milliseconds that this function will 
  wait for the object to be in signalled state. If the specified time has passed 
  and the event object is still in nonsignalled state, WaitForSingleObject returns 
  the the caller. If you want to wait for the object indefinitely, you must specify 
  the value INFINITE as this parameter. 
<h3> Example:</h3>
The example below displays a window waiting for the user to select a command from 
the menu. If the user selects "run thread", the thread starts the savage calculation. 
When it's finished, a message box appears informing the user that the job is done. 
During the time that the thread is running, the user can select "stop thread" 
to stop the thread. 
<p><b>.386</b> <br>
  <b>.model flat,stdcall</b> <br>
  <b>option casemap:none</b> <br>
  <b>WinMain proto :DWORD,:DWORD,:DWORD,:DWORD</b> <br>
  <b>include \masm32\include\windows.inc</b> <br>
  <b>include \masm32\include\user32.inc</b> <br>
  <b>include \masm32\include\kernel32.inc</b> <br>
  <b>includelib \masm32\lib\user32.lib</b> <br>
  <b>includelib \masm32\lib\kernel32.lib</b> 
<p><b>.const</b> <br>
  <b>IDM_START_THREAD equ 1</b> <br>
  <b>IDM_STOP_THREAD equ 2</b> <br>
  <b>IDM_EXIT equ 3</b> <br>
  <b>WM_FINISH equ WM_USER+100h</b> 
<p><b>.data</b> <br>
  <b>ClassName db "Win32ASMEventClass",0</b> <br>
  <b>AppName&nbsp; db "Win32 ASM Event Example",0</b> <br>
  <b>MenuName db "FirstMenu",0</b> <br>
  <b>SuccessString db "The calculation is completed!",0</b> <br>
  <b>StopString db "The thread is stopped",0</b> <br>
  <b>EventStop BOOL FALSE</b> 
<p><b>.data?</b> <br>
  <b>hInstance HINSTANCE ?</b> <br>
  <b>CommandLine LPSTR ?</b> <br>
  <b>hwnd HANDLE ?</b> <br>
  <b>hMenu HANDLE ?</b> <br>
  <b>ThreadID DWORD ?</b> <br>
  <b>ExitCode DWORD ?</b> <br>
  <b>hEventStart HANDLE ?</b> 
<p><b>.code</b> <br>
  <b>start:</b> <br>
  <b>&nbsp;&nbsp;&nbsp; invoke GetModuleHandle, NULL</b> <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp;&nbsp; hInstance,eax</b> <br>
  <b>&nbsp;&nbsp;&nbsp; invoke GetCommandLine</b> <br>
  <b>&nbsp;&nbsp;&nbsp; mov CommandLine,eax</b> <br>
  <b>&nbsp;&nbsp;&nbsp; invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT</b> 
  <br>
  <b>&nbsp;&nbsp;&nbsp; invoke ExitProcess,eax</b> 
<p><b>WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD</b> 
  <br>
  <b>&nbsp;&nbsp;&nbsp; LOCAL wc:WNDCLASSEX</b> <br>
  <b>&nbsp;&nbsp;&nbsp; LOCAL msg:MSG</b> <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp; wc.cbSize,SIZEOF WNDCLASSEX</b> <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp; wc.style, CS_HREDRAW or CS_VREDRAW</b> 
  <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp; wc.lpfnWndProc, OFFSET WndProc</b> <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp; wc.cbClsExtra,NULL</b> <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp; wc.cbWndExtra,NULL</b> <br>
  <b>&nbsp;&nbsp;&nbsp; push&nbsp; hInst</b> <br>
  <b>&nbsp;&nbsp;&nbsp; pop&nbsp;&nbsp; wc.hInstance</b> <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp; wc.hbrBackground,COLOR_WINDOW+1</b> <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp; wc.lpszMenuName,OFFSET MenuName</b> <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp; wc.lpszClassName,OFFSET ClassName</b> 
  <br>
  <b>&nbsp;&nbsp;&nbsp; invoke LoadIcon,NULL,IDI_APPLICATION</b> <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp; wc.hIcon,eax</b> <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp; wc.hIconSm,eax</b> <br>
  <b>&nbsp;&nbsp;&nbsp; invoke LoadCursor,NULL,IDC_ARROW</b> <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp; wc.hCursor,eax</b> <br>
  <b>&nbsp;&nbsp;&nbsp; invoke RegisterClassEx, addr wc</b> <br>
  <b>&nbsp;&nbsp;&nbsp; invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR ClassName,\</b> 
  <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ADDR&nbsp; 
  AppName,\</b> <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,\</b> 
  <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CW_USEDEFAULT,300,200,NULL,NULL,\</b> 
  <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hInst,NULL</b> 
  <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp; hwnd,eax</b> <br>
  <b>&nbsp;&nbsp;&nbsp; invoke ShowWindow, hwnd,SW_SHOWNORMAL</b> <br>
  <b>&nbsp;&nbsp;&nbsp; invoke UpdateWindow, hwnd</b> <br>
  <b>&nbsp;&nbsp;&nbsp; invoke GetMenu,hwnd</b> <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp; hMenu,eax</b> <br>
  <b>&nbsp;&nbsp;&nbsp; .WHILE TRUE</b> <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke 
  GetMessage, ADDR msg,NULL,0,0</b> <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .BREAK 
  .IF (!eax)</b> <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke 
  TranslateMessage, ADDR msg</b> <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke 
  DispatchMessage, ADDR msg</b> <br>
  <b>&nbsp;&nbsp;&nbsp; .ENDW</b> <br>
  <b>&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp;&nbsp;&nbsp; eax,msg.wParam</b> <br>
  <b>&nbsp;&nbsp;&nbsp; ret</b> <br>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品综合视频| 在线欧美日韩国产| 人人狠狠综合久久亚洲| 亚洲成av人在线观看| 亚洲九九爱视频| 一区二区三区日韩在线观看| 亚洲精品视频自拍| 亚洲第一狼人社区| 日本麻豆一区二区三区视频| 三级久久三级久久| 日本一区中文字幕| 免费av网站大全久久| 韩国成人福利片在线播放| 国内久久精品视频| 成人久久视频在线观看| 99视频国产精品| 欧美亚洲高清一区| 久久―日本道色综合久久| 久久综合资源网| 亚洲欧洲国产日韩| 日韩国产一区二| 国产成人精品一区二区三区网站观看| 国产传媒一区在线| 色综合天天性综合| 欧美mv和日韩mv的网站| 国产精品国产三级国产三级人妇| 依依成人精品视频| 黄色日韩网站视频| 色婷婷国产精品久久包臀 | 精品欧美久久久| 国产精品蜜臀在线观看| 亚洲成人资源在线| 国产电影精品久久禁18| 欧美日韩精品综合在线| 2020国产精品| 亚瑟在线精品视频| 成人久久视频在线观看| 日韩欧美亚洲国产另类| 亚洲另类春色校园小说| 国产在线视频一区二区| 精品视频全国免费看| 中文字幕免费观看一区| 蜜臀av性久久久久蜜臀aⅴ四虎| 99久久99久久久精品齐齐| 日韩免费观看2025年上映的电影| 亚洲欧美在线另类| 国产一区二区久久| 337p亚洲精品色噜噜噜| 一区二区三区高清| av一区二区三区| 欧美极品另类videosde| 久久成人免费电影| 日韩欧美一区电影| 亚洲国产一区二区三区青草影视| 国产aⅴ综合色| 欧美精品一区二区三| 午夜影视日本亚洲欧洲精品| 99精品桃花视频在线观看| 久久久影视传媒| 经典一区二区三区| 日韩欧美国产午夜精品| 日韩成人伦理电影在线观看| 欧美日韩精品系列| 亚洲精品久久久久久国产精华液| 国产成人精品1024| 久久久99久久精品欧美| 国内国产精品久久| 精品国产一区二区在线观看| 久久精品二区亚洲w码| 日韩欧美综合一区| 久久99国内精品| 久久网站热最新地址| 国产综合久久久久影院| 26uuu久久综合| 国产a区久久久| 亚洲日本中文字幕区| 色综合久久综合网欧美综合网| 国产精品久久久久国产精品日日| 成人国产精品免费观看视频| 亚洲欧美综合另类在线卡通| 91蝌蚪porny| 亚洲一区二区免费视频| 欧美日韩国产小视频| 免费观看在线色综合| 久久久久9999亚洲精品| 国产**成人网毛片九色| 日韩一区欧美小说| 欧美在线免费观看亚洲| 美女视频一区二区三区| 久久久亚洲国产美女国产盗摄 | 中文字幕欧美激情一区| 成人aa视频在线观看| 国产精品亲子伦对白| 色哟哟精品一区| 视频一区二区国产| 久久久久久久久久久电影| www.日韩在线| 亚洲地区一二三色| 久久综合色婷婷| 91蜜桃视频在线| 美女免费视频一区二区| 欧美国产精品中文字幕| 欧美三级电影精品| 国产在线精品一区在线观看麻豆| 亚洲天堂2014| 91精品国产综合久久蜜臀| 国产98色在线|日韩| 亚洲大片在线观看| 国产欧美久久久精品影院| 91成人免费在线视频| 精品一区二区成人精品| 亚洲在线视频网站| 精品国产乱码久久久久久牛牛| 91蝌蚪porny九色| 国产在线精品一区在线观看麻豆| 亚洲综合在线免费观看| 久久午夜国产精品| 欧美日韩在线播放一区| 成人黄色国产精品网站大全在线免费观看| 亚洲男帅同性gay1069| 久久久久国产精品厨房| 欧美高清视频在线高清观看mv色露露十八| 国产乱码精品一区二区三区av | 成人黄色在线视频| 麻豆视频观看网址久久| 一区二区欧美在线观看| 国产精品天干天干在线综合| 日韩三级在线免费观看| 欧洲av一区二区嗯嗯嗯啊| 粉嫩一区二区三区性色av| 蜜臀a∨国产成人精品| 亚洲午夜在线观看视频在线| 国产精品二区一区二区aⅴ污介绍| 日韩欧美一级二级三级久久久| 日本丰满少妇一区二区三区| 波多野结衣一区二区三区| 国产专区欧美精品| 麻豆成人免费电影| 日韩成人午夜精品| 天天色 色综合| 亚洲午夜激情av| 伊人性伊人情综合网| 亚洲四区在线观看| 亚洲欧洲成人自拍| 中文字幕一区二区三区色视频 | xf在线a精品一区二区视频网站| 欧美日韩亚洲国产综合| 精品久久久久av影院 | 成人av免费在线播放| 国产精品91一区二区| 国产精品一级在线| 国产尤物一区二区| 国产精品88av| 波多野结衣中文一区| 99精品国产热久久91蜜凸| 99久精品国产| 欧美日韩视频在线一区二区| 欧美日韩一卡二卡| 在线91免费看| 日韩欧美激情在线| 久久久国产一区二区三区四区小说 | 欧美一级欧美三级在线观看| 欧美人狂配大交3d怪物一区| 8v天堂国产在线一区二区| 日韩精品一区在线| 国产日韩av一区| 亚洲人成在线观看一区二区| 一区二区三区国产精品| 日韩成人av影视| 国产黄色精品网站| 日本高清不卡aⅴ免费网站| 91精品国产一区二区人妖| 亚洲精品在线观| 亚洲欧洲在线观看av| 亚洲电影一区二区三区| 久久国产人妖系列| av电影天堂一区二区在线| 欧美人xxxx| 国产欧美1区2区3区| 一区二区三区免费网站| 青青草成人在线观看| gogo大胆日本视频一区| 欧美一三区三区四区免费在线看| 久久久久国产精品厨房| 亚洲成人av一区二区三区| 国产激情视频一区二区三区欧美 | 国产精品视频你懂的| 一区二区视频在线看| 蜜桃传媒麻豆第一区在线观看| 成人国产精品免费网站| 在线播放亚洲一区| 国产精品国产三级国产普通话三级 | 日韩一二三区不卡| 国产精品不卡一区| 男人的天堂亚洲一区| 日本精品一区二区三区高清| 久久久综合九色合综国产精品| 亚洲午夜免费福利视频| 99精品欧美一区| 精品国产91洋老外米糕|