首页
社区
课程
招聘
[原创]多桌面切换程序-通杀所有网管程序
发表于: 2007-11-29 00:11 19362

[原创]多桌面切换程序-通杀所有网管程序

2007-11-29 00:11
19362

程序说明:
   程序启动后没用任何界面,只会再创建一个桌面,用WIN+1和WIN+2组合键在两个桌面间切换。一个桌面用于工作,一个桌面用于娱乐,互不干扰。


[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)

上传的附件:
收藏
免费 7
支持
分享
最新回复 (33)
雪    币: 1852
活跃值: (504)
能力值: (RANK:1010 )
在线值:
发帖
回帖
粉丝
2
叫系统有点大了
2007-11-29 10:11
0
雪    币: 750
活跃值: (228)
能力值: ( LV9,RANK:780 )
在线值:
发帖
回帖
粉丝
3
呵呵,是有点,已修正!
2007-11-29 11:40
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
不错的东东哈。。。。
2007-11-29 13:09
0
雪    币: 268
活跃值: (40)
能力值: ( LV10,RANK:170 )
在线值:
发帖
回帖
粉丝
5
不错啊,支持个

2007-11-29 13:49
0
雪    币: 66
活跃值: (16)
能力值: ( LV8,RANK:130 )
在线值:
发帖
回帖
粉丝
6
nice job  :)

我们这儿网吧的插卡器跟机箱电源连着-。-
2007-11-29 15:36
0
雪    币: 486
活跃值: (13)
能力值: ( LV9,RANK:430 )
在线值:
发帖
回帖
粉丝
7
强大啊。佩服。
(而我还是那么菜。 )
以后多发原创啊。

请教一下,程序的原理就是创建一个新的桌面,接着加个拦截关机,拦截鼠标锁定的功能,就是这么简单吗??

你是怎么想到用这个来实现突破网吧限制的??

问题是如果上面的拦截功能被客户端给先拦截了,那会怎么样?
2007-11-29 21:37
0
雪    币: 709
活跃值: (2420)
能力值: ( LV12,RANK:1010 )
在线值:
发帖
回帖
粉丝
8
虚拟桌面吧。codeproject上早有了。。。

Introduction
In my mind by far the coolest feature that a desktop manager can have is proper multiple (virtual) desktopping (shallow, I know). So, Windows XP doesn't have this feature, ah well there's a PowerTool that does it. Except - you can't change desktop just by mousing off the edge, and more seriously there doesn't appear to be any mechanism to transfer windows between desktops - which is very annoying, as things never open where you want them to.
Concept
I thought that the easiest way to do this is simply to show and hide windows in such a way as to give the impression of more than one desktop. About halfway through writing this I discovered SwitchDesktop, which looked quite complicated so I didn't bother trying it that way.
Technical Details
The program is an MFC Dialog App.
I found out how to list all the windows on the system and show and hide them from the tbarsort article. I ask Windows for handles to every window on the system using EnumWindows and filter out the irrelevant ones.
bool ValidWindow(HWND hwnd)
{
  if (!IsWindowVisible(hwnd)) return false;
  if (GetWindowTextLength(hwnd) == 0) return false;
  if (GetAsyncKeyState(VK_LBUTTON) && hwnd==GetForegroundWindow()) return false;
  char str[100];
  GetWindowText(hwnd,str,99);
  if(strncmp(str,"Desktop",100)==0) return false;
  if(strncmp(str,"Program Manager",100)==0) return false;
  return true;
}
BOOL CALLBACK AddToList(HWND hwnd,LPARAM ret)
{
  std::vector<HWND>* vecret=(std::vector<HWND>*)ret;
  if(ValidWindow(hwnd)) vecret->push_back(hwnd);
  return TRUE;
}
std::vector<HWND> WindowList()
{
  std::vector<HWND> windows;
  EnumWindows(AddToList,LPARAM(&windows));
  return windows;
}
Desktops can be switched by pressing the relevant button or with a keyboard shortcut, implemented with RegisterHotKey, for example Win+1 is registered by
RegisterHotKey(GetSafeHwnd(),1,MOD_WIN,'1');
For some reason the MFC ClassWizard doesn't know about the WM_HOTKEY message, so it has to be added manually to the message map:
ON_MESSAGE(WM_HOTKEY,OnHotKey)
By far the hardest thing to do was to detect when the mouse touched the edge of the screen (which is when the desktops change). Eventually I found the MouseHookDlg project (although I can't currently find a reference for it), which shows how to install a global mouse hook. All I have to do is package the dll with my app and call the simple function API_SetHooks to register a mouse callback, and put a handler in the message map:
ON_REGISTERED_MESSAGE(UWM_MOUSEMOVE, OnHookMouseMove)
having first registered this mesage by
UWM_MOUSEMOVE = RegisterWindowMessage(UWM_SHELL_HOOK_MSG);
Finally, I wanted it to be possible to drag windows off the side of the screen and have them come with you to the new desktop. I failed to find an actual way of checking if any windows are being dragged (I suspect it can be done with another global hook), instead if the left mouse button is down as the desktops are switched then the foreground window is transfered, hence the line
if (GetAsyncKeyState(VK_LBUTTON) && hwnd==GetForegroundWindow()) return false;
in the ValidWindow above, this works well but occasionally leads to accidental window transfers.
Conclusion
The program works fine, with one or two minor bugs (not bad for only a few hours' work). Occasionally windows get transfered when not intended, and much worse occasionally they get permanently hidden (don't do any absolutely vital work whilst using this program, there is a small chance that this will happen and you will be unable to save). I would be glad of suggestions for bug fixes especially for improving the dragging detection, extra features are unlikely to get added.
Blatant plug: visit my site for mostly various games written using OpenGL with MFC or GLUT.
2007-11-29 21:50
0
雪    币: 709
活跃值: (2420)
能力值: ( LV12,RANK:1010 )
在线值:
发帖
回帖
粉丝
9


上传的附件:
2007-11-30 06:34
0
雪    币: 145
活跃值: (85)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
10
下载了,如何不顶一下。
2007-11-30 12:27
0
雪    币: 145
活跃值: (85)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
11
冒昧问下。这个代码咋没有呀HookDll.dll
2007-11-30 12:29
0
雪    币: 145
活跃值: (85)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
12
sudami
--------------------Configuration: Multiple Desktops - Win32 Debug--------------------
Error scanning file C:\Documents and Settings\Administrator\桌面\multipledesktops\res\Multiple Desktops.rc2 for dependencies.
Compiling resources...
C:\Documents and Settings\Administrator\桌面\multipledesktops\Multiple Desktops.rc(186) : 致命错误 RC1015: 无法打开包含文件 'res\Multiple Desktops.rc2'.
执行 rc.exe 时出错.

------------------------
编译出现这个问题。
2007-11-30 12:36
0
雪    币: 224
活跃值: (147)
能力值: ( LV9,RANK:970 )
在线值:
发帖
回帖
粉丝
13
就只是个虚拟桌面....
2007-11-30 15:27
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
14
太强了,顶一下
2007-11-30 15:30
0
雪    币: 321
活跃值: (271)
能力值: ( LV13,RANK:1050 )
在线值:
发帖
回帖
粉丝
15
好,帮顶。。。
2007-11-30 16:04
0
雪    币: 1844
活跃值: (35)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
16
很好,有意思
2007-11-30 17:54
0
雪    币: 1852
活跃值: (504)
能力值: (RANK:1010 )
在线值:
发帖
回帖
粉丝
17
这次网吧被你搞的非安全了
能从多桌面切换联想到网吧,很邪恶
2007-11-30 21:06
0
雪    币: 437
活跃值: (273)
能力值: ( LV12,RANK:240 )
在线值:
发帖
回帖
粉丝
18
正好我常驻网吧 试试看
2007-11-30 22:17
0
雪    币: 424
活跃值: (10)
能力值: ( LV9,RANK:850 )
在线值:
发帖
回帖
粉丝
19
na ni!?
我不常驻网吧的也要试试看
2007-12-3 01:09
0
雪    币: 707
活跃值: (1301)
能力值: ( LV9,RANK:190 )
在线值:
发帖
回帖
粉丝
20
有时两个桌面间切换没响应,这是BUG吗?
2007-12-3 14:48
0
雪    币: 20
活跃值: (37)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
21
呵呵!挺好的如果能杀掉那个讨厌的实名卡更好了,你们都不知道辽宁省为了赚更多的钱强制每个网吧必须使用实名卡!如果没有这个卡就不让上网,网吧老板为不赔本只能让每个来上网的客户来买这个“实名卡”。
郁闷!
2007-12-3 16:50
0
雪    币: 20
活跃值: (37)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
22
如果我有双翅膀坚决飞离这个垃圾地方。
2007-12-3 16:51
0
雪    币: 210
活跃值: (28)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
23
以前用过,不过是用非asm写的,几百K,下了,用fasm的格式重写一下“”“”“”
2007-12-3 22:34
0
雪    币: 210
活跃值: (28)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
24
看了,作者好像是黑防的VIP。只讨论tech,不看个人
2007-12-3 22:40
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
25
我们这边下机直接关电源,有没有拦截对电源操作的软件。
2007-12-12 10:08
0
游客
登录 | 注册 方可回帖
返回
//