CC++程序怎么实现锁屏功能?

CC++程序怎么实现锁屏功能?,第1张

一个思路:

1) 使用SetWindowsHookEx(),注册keyboard hook和mouse hook;注意,在hook中扰败,一定要调用码冲之前返缓模颤回的函数

2)一旦hook函数被调用,则重启定时器

3)定时器超时,则调用LockWorkStation()锁屏

在Win_TC里运行 #include<stdio.h>

#include<stdlib.h>

#include<graphics.h>

char a[100]="zhangyafei"

char b[100]

char str[100]=""

int p=1

int i

void main()

{

int gdriver=DETECT, gmode

initgraph(&gdriver, &gmode, " ")

randomize()

do

{

while(!kbhit())

{

i++

if(i==300)

{

i=0

cleardevice()

}setcolor(rand()%16)

circle(rand()%600,rand()%450,rand()%50)

setcolor(rand()%16)

moveto(rand()%getmaxx(),rand()%getmaxy())

lineto(rand()%getmaxx(),rand()%getmaxy())

/*

setbkcolor(rand()%16)

sleep(1)

*/setcolor(rand()%16)

arc(rand()%getmaxx(),rand()%getmaxy(),rand()%getmaxx(),rand()%360,rand()%360) }

cleardevice()

setcolor(6)

settextstyle(0,0,3)

outtextxy(80,getmaxy()/2,"Please Input Password!")

scanf("%s",&b)

cleardevice()

if(strcmp(a,b))

{

p=1

outtextxy(100,getmaxy()/2,"Password is Wrong!")

sleep(1)

}

else

{

p=0

outtextxy(100,getmaxy()/2,"Password is Correct")

sleep(1)

}

}

while(p)

closegraph()

return 0

}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12390211.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-25
下一篇 2023-05-25

发表评论

登录后才能评论

评论列表(0条)

保存