-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchild.cpp
49 lines (37 loc) · 890 Bytes
/
child.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#define NUM_OF_THREAD 2 // dinh nghia so thread de tao
extern HANDLE smp;
char text[]="this is a text";
DWORD WINAPI task1(LPVOID){
HWND hWin;
hWin = FindWindow("Shell_TrayWnd",NULL); //tim thanh taskbar
EnableWindow(hWin,true);
while(1){
ShowWindow(hWin,false);
Sleep(1000);
ShowWindow(hWin,true);
Sleep(1000);
}
return 0;
}
DWORD WINAPI task2(LPVOID x){
printf("Your taskbar is now twinkling...\nPress any key to stop.");
return 0;
}
int main(){
printf("begin\n");
HANDLE thr[NUM_OF_THREAD]; //tao mang thr 2 ptu kieu Handle;
DWORD thrid;
//tao thread cho task1()
thr[0]=CreateThread(NULL,0,task1,NULL,0,&thrid);
Sleep(500);
//tao thread cho task2()
thr[1]=CreateThread(NULL,0,task2, (LPVOID)text,0,&thrid);
///Sleep(500);
getch();
CloseHandle(thr[0]);
CloseHandle(thr[1]);
return 0;
}