Chinaunix首页 | 论坛 | 博客
  • 博客访问: 456143
  • 博文数量: 724
  • 博客积分: 40000
  • 博客等级: 大将
  • 技术积分: 5010
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-13 14:47
文章分类

全部博文(724)

文章存档

2011年(1)

2008年(723)

我的朋友

分类:

2008-10-13 17:06:08

隐藏你的鼠标
作者:


(注意:本代码具有一定的危险性,如您无法控制您的计算机,请注销或重新启动)

一、建立一个单文档的应用程序框架
二、为隐藏主窗口,将OnCreate 删除。
并在App类里修改m_pMainWnd指向ShowWindow(SW_HIDE)
三、现在在mainframe的实现文件里添加如下内容:

POINT mp,cursorNew;
/////////////////////////////////////
// CMainFrame construction/destruction
UINT FMouse(LPVOID param)
{
	int flag=0;

	WINDOWPLACEMENT wp;///窗口位置
	wp.length=sizeof(WINDOWPLACEMENT);
	HWND hWnd;
	char tmp[20];
	RECT rt;
	hWnd=GetDesktopWindow();////GetForegroundWindow();
	GetWindowPlacement(hWnd,&wp);
	GetWindowRect(hWnd,&rt);
	GetWindowText(hWnd,tmp,20);

	HDC dc=GetDC((HWND)param);

        int iResult;
	iResult=AfxMessageBox("确实要隐藏吗?",MB_OKCANCEL);
	if(iResult==IDOK)
	{
		while(1)
		{
			hWnd=GetForegroundWindow();//GetDesktopWindow();
			GetWindowRect(hWnd,&rt);
			GetWindowText(hWnd,tmp,20);
			GetWindowPlacement(hWnd,&wp);
			GetCursorPos(&cursorNew);
			while(1){
			::mouse_event(MOUSEEVENTF_MOVE,cursorNew.x,cursorNew.y,0,0);
			}
		}
	}
	return 0;
}
在构造函数里启动线程
CMainFrame::CMainFrame()
{
	HWND hWnd=::GetParent(NULL);
	GetCursorPos(&mp);
	AfxBeginThread(FMouse,hWnd,0);	
}
OK 试试看吧,注销一下就没事了!


--------------------next---------------------

阅读(159) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~