选择显示字体大小

通过api和键盘钩子彻底屏蔽任务栏和开始菜单

 

  在一些碰到过的多媒体软件编制过程中通常需要彻底屏蔽任务条,通常的办法是调用showwindow(h,sw_hide)来隐藏任务条,但是不能屏蔽开始菜单,通过键盘的win功能键还是可以打开开始菜单,所以配合键盘钩子,来屏蔽开始菜单。


library hide;

{ important note about dll memory management: sharemem must be the
first unit in your library's uses clause and your project's (select
project-view source) uses clause if your dll exports any procedures or
functions that pass strings as parameters or function results. this
applies to all strings passed to and from your dll--even those that
are nested in records and classes. sharemem is the interface unit to
the borlndmm.dll shared memory manager, which must be deployed along
with your dll. to avoid using borlndmm.dll, pass string information
using pchar or shortstring parameters. }

uses
sysutils,
classes,
windows,
messages;

var
hhk :hhook;
type
pkbdllhookstruct = ^kbdllhookstruct;
kbdllhookstruct = record
vkcode: dword;
scancode: dword;
flags: dword;
time: dword;
dwextrainfo: dword;
end;
{$r *.res}
function ycxsks( yc:boolean): boolean;stdcall; //隐藏-显示任务条
var
h:thandle;
begin
if yc = true then
begin
h:=findwindow('shell_traywnd',nil);
showwindow(h,sw_hide); //隐藏任务条
end
else
begin
h:=findwindow('shell_traywnd',nil);
showwindow(h,sw_show); //显示任务条
end;
result:=true;
end;

function keyhookproc(ncode: integer;wparam: wparam;lparam: lparam): lresult;stdcall;
//调用键盘钩子,屏蔽左右win功能键
var
p: pkbdllhookstruct;
y: integer;
begin
if ncode<0 then
result:= callnexthookex(hhk,ncode,wparam,lparam)
else
begin
y := 0;
case wparam of
wm_keydown,wm_syskeydown: //按键后判断所按键
begin
p:=pkbdllhookstruct(lparam);
if p^.vkcode = vk_lwin then
y := 1;
if p^.vkcode = vk_rwin then
y := 1;
end;
wm_keyup,wm_syskeyup: //松开按键后判断所按键
begin
p:=pkbdllhookstruct(lparam);
if p^.vkcode = vk_lwin then
y := 1;
if p^.vkcode = vk_rwin then
y := 1;
end;
end;
if y=1 then
result:=1 //如果为win功能键则屏蔽
else
result:= callnexthookex(hhk,ncode,wparam,lparam); //其他键放下一个钩子
end
end;

function enablehide:boolean;stdcall;export; //外部调用
begin
if hhk = 0 then
begin
hhk := setwindowshookex(13,@keyhookproc,hinstance,0);
result := true;
end
else
result := false;
ycxsks(true);
end;

function disablehide:boolean; stdcall; export; //外部调用
begin
if hhk <> 0 then
begin
unhookwindowshookex(hhk);
hhk := 0;
result := true;
end
else
result := false;
ycxsks(false);
end;

exports
enablehide,
disablehide;
end


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons