祝愿大家身体健康!

 站点注册  找回密码
 站点注册

QQ登录

只需一步,快速开始

查看: 6157|回复: 0

[参考资料] PB开发的程序如何不显示在任务栏

[复制链接]

[参考资料] PB开发的程序如何不显示在任务栏

[复制链接]
ehxz

主题

0

回帖

57万

积分

管理员

积分
570013
贡献
在线时间
小时
2013-2-24 07:31:50 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?站点注册

×

         假设pb开发的程序的主窗口为w_main,如果需要在程序运行时,使w_main的标题不显示在操作系统的任务栏上,可以这样处理:


         (1)建立一个 visible 属性为 false 的 main!  类型窗口,假设为w_hide。

         (2)在application的open事件中,写:

[cpp] view plaincopy


  • open(w_hide)  
  •   
  • open(w_main, w_hide)  


然后在 w_main 的 close 事件中写:

[cpp] view plaincopy


  • if isvalid(w_hide) then close(w_hide)  


        这样一来,运行后的pb程序就不会在任务栏上显示了,不过通过按 Alt + Tab 快捷键切换程序时,还是可以看到该pb程序。 如果需要使得pb程序在按 Alt + Tab 快捷键切换程序时不可见,则要加上以下几个步骤:

         (3)建立如下自定义不可视对象 nvo_hideprocess (将以下内容保存为本地文件 nvo_hideprocess.sru ,然后导入pbl中)

[cpp] view plaincopy


  • $PBExportHeader$nvo_hideprocess.sru  
  • forward  
  • global type nvo_hideprocess from nonvisualobject  
  • end type  
  • end forward  
  •   
  • global type nvo_hideprocess from nonvisualobject autoinstantiate  
  • end type  
  •   
  • type prototypes  
  • FUNCTION long GetWindowLong(ulong hwnd,long nIndex) LIBRARY "user32.dll" ALIAS FOR "GetWindowLongA"  
  •    
  • FUNCTION long SetWindowlong(ulong hwnd,long nIndex,long dwNewLong) LIBRARY "user32.dll" ALIAS FOR "SetWindowLongA"  
  • end prototypes  
  •   
  • forward prototypes  
  • public subroutine of_hideprocess (long ahwd)  
  • public function boolean of_is_in (long al_in, long al_all)  
  • end prototypes  
  •   
  • public subroutine of_hideprocess (long ahwd);//隐藏进程  
  • constant long WS_EX_TOOLWINDOW = 128  
  • Constant long WS_EX_LAYERED = 524288  
  • Constant long WS_EX_APPWINDOW  = 262144  
  • Constant long GWL_EXSTYLE = - 20  
  • constant long WS_EX_PALETTEWINDOW=392  
  • long dwExStyle  
  • dwExStyle = GetWindowLong(ahwd, GWL_EXSTYLE)  
  • if not of_is_in(WS_EX_TOOLWINDOW, dwExStyle) then dwExStyle += WS_EX_TOOLWINDOW  
  •    
  • SetWindowLong(ahwd, GWL_EXSTYLE, dwExStyle)  
  • end subroutine  
  •   
  • public function boolean of_is_in (long al_in, long al_all);  
  • //====================================================================  
  • // 判断数字al_in是不是包含在数字al_all中  
  • // al_all是 1、2、4、8、16、32、64...等数字中的若干个的和  
  • // al_in 是 1、2、4、8、16、32、64...等数字中的某一个  
  • //====================================================================  
  • dec ld  
  • ld = log(al_in) / log(2)  
  • if int(ld) <> ld then return false  
  • long n, m  
  • m = al_in + int(al_all / (al_in * 2)) * (2 * al_in)  
  • if al_all >= m and al_all < m + al_in then return true  
  • return false  
  • end function  
  •   
  • on nvo_hideprocess.create  
  • call super::create  
  • TriggerEvent( this, "constructor" )  
  • end on  
  •   
  • on nvo_hideprocess.destroy  
  • TriggerEvent( this, "destructor" )  
  • call super::destroy  
  • end on  


         (4)在 w_hide 的 open 事件中加上:

[cpp] view plaincopy


  • //Alt + Tab 时,如果不隐藏程序,则屏蔽以下代码  
  • nvo_hideprocess ln  
  • ln.of_hideprocess(handle(this))  


共享共进共赢Sharing And Win-win Results
SYBASEBBS - 免责申明1、欢迎访问“SYBASEBBS.COM”,本文内容及相关资源来源于网络,版权归版权方所有!本站原创内容版权归本站所有,请勿转载!
2、本文内容仅代表作者观点,不代表本站立场,作者自负,本站资源仅供学习研究,请勿非法使用,否则后果自负!请下载后24小时内删除!
3、本文内容,包括但不限于源码、文字、图片等,仅供参考。本站不对其安全性,正确性等作出保证。但本站会尽量审核会员发表的内容。
4、如本帖侵犯到任何版权问题,请立即告知本站 ,本站将及时删除并致以最深的歉意!客服邮箱:admin@sybasebbs.com
您需要登录后才可以回帖 登录 | 站点注册

本版积分规则

免责声明:
本站所发布的一切破解补丁、注册机和注册信息及软件的解密分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:Admin@SybaseBbs.com

QQ|Archiver|PowerBuilder(PB)BBS社区 ( 鲁ICP备2021027222号-1 )

GMT+8, 2024-4-20 12:49 , Processed in 0.107667 second(s), 10 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表