频道直达 - 专题 - 新闻 - 技巧 - 组网 - 开发 - 安全 - web编程 - 图像 - 操作系统 - 数据库 - 教育 - 旅游 - 健康 - 时尚 - 驱动 - 软件 - 游戏 - 多媒体 - ERP - 讨论组

在隐含工具条中如何建立一个ActiveX控件

来源: 作者: 出处:巧巧读书 2006-11-25 进入讨论组

  How to create an ActiveX Control which hides the Taskbar

This tip shows how to really hide the Windows Taskbar, not to move it outside the desktop, and to avoid the API磗 in the future we can make an ActiveX Control which does the work.

First create a new ActiveX Control project, add a module to it, just like you would in a normal .exe project. Put the following API declaracions into it:

Declare Function ShowWindow Lib _
"user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long

Declare Function FindWindow Lib _
"user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As LongNow we have to set some properties for the UserControl1.

Name="TaskBar"
BorderStyle=1-Fixed Single
CanGetFocus=False
EditAtDesignTime=False
InvisibleAtRuntime=True
Picture= Choose one
ToolBoxBitmap=Choose one
Adjust the UserControl磗 size to the picture.

Put the following codes to the UserControl:

注释:Creates the property TaskBar.Show
Public Property Let Show(ByVal VShow As Boolean)
TBwnd& = FindWindow("Shell_traywnd", "")

If VShow = True Then
注释:if TaskBar.Show=true it shows the TaskBar
ShowWnd& = ShowWindow(TBwnd&, 1)
Else
注释:if not it hides the TaskBar
ShowWnd& = ShowWindow(TBwnd&, 0)
End If
End PropertySave your project with the name TaskBar and "Make TaskBar.ocx".

Now we have to try the Control so create a new (normal) .exe app and put 2 commandbuttons on form1, with the captions "Show" and "Hide".  We have to look for our own control now, click menu-project-components (or right click on the toolbox),   normally all ActiveX Controls (.ocx) are located in your windowssystem folder they should appear directlly in the list if not click on the browse button and select the pathTaskBar.ocx, and confirm.  The Control should appear in the toolbox with the picture you磛e selected in ToolBoxBitmap.

Place the Control on the form together with the 2 commandbuttons and add the following code to the click events of the commandbuttons:

Private Sub Command1_Click()
taskbar1.Show = True
End Sub

Private Sub Command2_Click()
taskbar1.Show = False
End SubExecute the app. (F5) and click on the buttons.

   巧巧读书:http://www.qqread.com/vb/e282037.html

进入讨论组讨论。
收藏此文】【 】【打印】【关闭
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
巧巧读书宗旨
相关专题
最新论坛文章
站内各频道最新更新文档
站内最新制作专题
热门关键字导读
Photoshop教 程照片处理 照片制作 PS快捷键 抠图
计 算 机 故 障XP系统修复
艺 术 与 设 计设计 流媒体 设计欣赏 边框
计 算 机 安 全ARP
站内频道文章精选
巧巧电脑频道编辑信箱  告诉我们您想看的专题或文章