我要在开始菜单里的程序组中创建一个程序的多级菜单快捷方式,该怎么做呢?如:开始——>程序——>我的程序——>执行程序
——>卸载
....
——>示例——>示例1
——>示例2
....我现在只能建一级。
——>卸载
....
——>示例——>示例1
——>示例2
....我现在只能建一级。
解决方案 »
- 菜鸟问个问题
- 请教一下在类模块中定义变量的问题!
- 高分示助>>>>>>在线等:哪个高手知道—怎么动态定义对象及动态调用对象方法
- 哪位能给推荐一个支持VB的UML建模工具啊,要求体积要小,实用!
- 关于TTS语音技术的两个问题,请帮帮忙!
- =========入门问题:如何组织数据?========
- 在form1的一批数据要在form2里用,应该怎么做
- 谁能不用VB自带的ComBoBox控件,自己做一个出来??高分奉送!
- langzhi:有没有关于listview滚动的事件?就是当我拖动滚动条时,触发什么事件?
- 如何编写游戏修改程序
- 关于文件拷贝的问题!
- 郁闷,一个SQL语句加上 order by 从句后就出错,请大虾帮忙,100分相送!
(ByVal lpstrDirName As String) As LongDeclare Function fCreateShellLink Lib "STKIT432.DLL" (ByVal _
lpstrFolderName As String, ByVal lpstrLinkName As String, _
ByVal lpstrLinkPath As String, ByVal lpstrLinkArgs As String) As LongPublic Sub CreateShellGroup(ByVal strFolderName As String)If strFolderName = "" Then
Exit Sub
End IfDim fSuccess As Boolean
fSuccess = OSfCreateShellGroup(strFolderName)End Sub
'use asDim res&
Dim vLocation$vLocation$ = "testing"
Call CreateShellGroup(vLocation$)
vLocation$ = "..\..\Start Menu\Programs\" & vLocation$
res& = fCreateShellLink(vLocation, [title], [path&executable], "")'where
' title = name to be mentioned
' path&executable = full path and executable name of application
' great installation apps.
'
' The functions in this module enable you to :
'
' Create Program Manager Groups (CreateProgmanGroup)
' Create Program Manager Icons (CreateProgmanGroup)
' Delete Program Manager Group (DeleteProgmanGroup)
' Restore Program Manager wind. (Restore Program Manager)
' Shade Form like in other setup progs. (ShadeForm)
'
' See the subs for parameters and that kind of stuff.
' To use these functions you must have a label called DDELabel
' on your form (used for DDE). With Search and Replace in this
' module you can specify your own label name.
'
' I've tested it with Windows95. It only create menu items in
' the taskbar.Sub CreateProgManGroup(xForm As Form, GroupName As String, GroupPath As Stri
ng)' Sub/Function Name : CreateProgManGroup
' Purpose : Create Program Manager Group
' Parameters : xForm (Form with Label named DDELabel)
' Groupname (Name of Group to create)
' GroupPath (Path were group is to be created
)
' Created by : Paul Treffers
' Date Created : 12/05/95Screen.MousePointer = 11
'----------------------------------------------------------------------
' Windows requires DDE in order to create a program group and item.
' Here, a Visual Basic label control is used to generate the DDE messag
es
'----------------------------------------------------------------------
On Error Resume Next
'--------------------------------
' Set LinkTopic to PROGRAM MANAGER
'--------------------------------
xForm.DDELabel.LinkTopic = "ProgMan/Progman"
xForm.DDELabel.LinkMode = 2
For I% = 1 To 10 ' Loop to ensu
re that there is enough time to
Z% = DoEvents() ' process DDE
Execute. This is redundant but needed
Next ' for debug wi
ndows.
xForm.DDELabel.LinkTimeout = 100
'---------------------
' Create program group
'---------------------
xForm.DDELabel.LinkExecute "[CreateGroup(" + GroupName$ + Chr$
(44) + GroupPath$ + ")]"
'-----------------
' Reset properties
'-----------------
xForm.DDELabel.LinkTimeout = 50
xForm.DDELabel.LinkMode = 0Screen.MousePointer = 0
End SubSub CreateProgManItem(xForm As Form, CmdLine As String, IconTitle As String)' Sub/Function Name : CreateProgManItem
' Purpose : Create Program Manager Item in Group
' Parameters : xForm (Form with Label named DDELabel)
' CMDLine (specify here a executable that is
to be executed)
' IconTitle (specify here a title for the ico
n)
' Created by : Paul Treffers
' Date Created : 12/05/95Dim I%
Dim Z%
Screen.MousePointer = 11'----------------------------------------------------------------------
' Windows requires DDE in order to create a program group and item.
' Here, a Visual Basic label control is used to generate the DDE messag
es
'----------------------------------------------------------------------
On Error Resume Next
'---------------------------------
' Set LinkTopic to PROGRAM MANAGER
'---------------------------------
xForm.DDELabel.LinkTopic = "ProgMan/Progman"
xForm.DDELabel.LinkMode = 2
For I% = 1 To 10 ' Loop to ensu
re that there is enough time to
Z% = DoEvents() ' process DDE
Execute. This is redundant but needed
Next ' for debug wi
ndows.
xForm.DDELabel.LinkTimeout = 100
'------------------------------------------------
' Create Program Item, one of the icons to launch
' an application from Program Manager
'------------------------------------------------
xForm.DDELabel.LinkExecute "[AddItem(" + CmdLine + Chr$(44) +
IconTitle + Chr$(44) + ",,)]"
xForm.DDELabel.LinkExecute "[ShowGroup(groupname, 1)]"
'-----------------
' Reset properties
'-----------------
xForm.DDELabel.LinkTimeout = 50
xForm.DDELabel.LinkMode = 0
Screen.MousePointer = 0
End SubSub DeleteProgManGroup(xForm As Form, GroupName As String)' Sub/Function Name : CreateProgManGroup
' Purpose : Create Program Manager Group
' Parameters : xForm (Form with Label called DDELabel)
' Groupname (Name of Group to delete)
' Created by : Paul Treffers
' Date Created : 12/05/95
Dim I%
Dim Z%
Screen.MousePointer = 11
On Error Resume Next
xForm.DDELabel.LinkTopic = "ProgMan/Progman"
xForm.DDELabel.LinkMode = 2
For I% = 1 To 10 ' Loop to ensu
re that there is enough time to
Z% = DoEvents() ' process DDE
Execute. This is redundant but needed
Next ' for debug wi
ndows.
xForm.DDELabel.LinkTimeout = 100
xForm.DDELabel.LinkExecute "[DeleteGroup(" + GroupName$ + &quo
t;)]"
xForm.DDELabel.LinkTimeout = 50
xForm.DDELabel.LinkMode = 0
Screen.MousePointer = 0End SubSub RestoreProgMan()
' Sub/Function Name : Restore Program
' Purpose : Restores Program Manager Window
' Call this sub before starting dde with prog
ram manager
' Created by : Paul Treffers
' Date Created : 12/05/95
On Error GoTo RestoreProgManErr
AppActivate "Program Manager" ' Activate Program Manager.
SendKeys "%{ }{Enter}", True ' Send Restore keystrokes.
RestoreProgManErr:
Exit Sub
End SubSub ShadeForm(Frm As Form)' Sub/Function Name : ShadeForm
' Purpose : Created a shaded form like the microsoft se
tups
' Parameters : Form (Frm)
' Created by : Paul Treffers
' Date Created : 12/05/95
Dim I As Integer
Dim NumberOfRects As Integer
Dim GradColor As Long
Dim GradValue As Integer
Frm.ScaleMode = 3
Frm.DrawStyle = 6
Frm.DrawWidth = 2
Frm.AutoRedraw = True
NbrOfRects = 64
For I = 1 To 64
GradValue = 255 - (I * 4 - 1)
GradColor = RGB(0, 0, GradValue)
Frm.Line (0, Frm.ScaleHeight * (I - 1) / 64)-(Frm.ScaleWidth, Frm.Sc
aleHeight * I / 64), GradColor, BF
Next I
Frm.RefreshEnd Sub
以上代码保存于: SourceCode Explorer(源代码数据库)
复制时间: 2005-11-11 15:18:54
软件版本: 1.0.882
软件作者: Shawls
E-Mail: [email protected]
QQ: 9181729
受"用DDE连接方法向开始菜单中添加快捷方式"一文的启发,我写了一个可以向桌面增加快捷方式的小程序。与调用Vb5stkit.dll或Vb6stkit.dll来建立快捷方式相比,最大的特点在于避免了对该DLL文件的依赖(并不是每一台Win9x的机上都有的这些文件的)。是不是很环保?
原理:利用Text控件的DDE在系统开始菜单中添加一个快捷方式,然后将该快捷方式剪切到桌面上来。
须解决的问题:取得系统开始菜单和桌面的路径。这其中当然免不了要调用到API的SHGetSpecialFolderLocation 和SHGetPathFromIDList 函数。 实现步骤: 1.新建工程; 2.在表单中增加一个文本框(txtLnk)及一个命令按钮(cmdMakeLnk); 3.加入以下代码:Option Explicit
Const CSIDL_DESKTOP = &H0 系统桌面
Const CSIDL_PROGRAMS = &H2 系统"开始-$#@62;程序"菜单
Private Type SHITEMID
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST
mkid As SHITEMID
End Type
Private Declare Function SHGetSpecialFolderLocation _
Lib "shell32.dll" (ByVal hwndOwner As Long, _
ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib _
"shell32.dll" Alias "SHGetPathFromIDListA" _
(ByVal pidl As Long, ByVal pszPath As String) As Long
定义取得系统特定文件夹的路径的函数。Private Function GetSpecialfolder(CSIDL As Long) As StringDim lRet As LongDim IDL As ITEMIDLISTDim sPath As StringlRet = SHGetSpecialFolderLocation(100, CSIDL, IDL) 错误时返回非0值If lRet = 0 ThensPath = Space$(512)lRet = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal sPath) 一定要删除末尾的 0 字节。这在调用API时常常会遇到。GetSpecialfolder = Left$(sPath, InStr(sPath, Chr$(0)) - 1)Exit FunctionEnd IfGetSpecialfolder = ""End FunctionPrivate Sub cmdMakeLnk_Click()Dim sProgramsPath As StringDim sDesktopPath As StringsProgramsPath = GetSpecialfolder(CSIDL_PROGRAMS)sDesktopPath = GetSpecialfolder(CSIDL_DESKTOP)txtLnk.LinkTopic = "Progman|Progman"txtLnk.LinkMode = 2
格式: "[AddItem($#@60;欲建立快捷方式的命令行(可以是文件夹)$#@62;,$#@60;快捷方式的名称$#@62; ,[快捷方式的图标文件],[第几个图标])]" 注意: 1、由于文件名是字符串,所以必须加引号,也就是以下这行命令为什么们用了两个引号的原因 2、在"快捷方式的图标文件"中所出现的路径及文件必须是8.3格式,不支持长文件名。 下面假设为 C:\WINDOWS\CALC.EXE建立快捷方式txtLnk.LinkExecute "[AddItem(""C:\WINDOWS\CALC.EXE"",""计算器"" )]" 将快捷方式移至桌面sProgramsPath = sProgramsPath & "\计算器.lnk"sDesktopPath = sDesktopPath & "\计算器.lnk"FileCopy sProgramsPath, sDesktopPath
Kill sProgramsPath
End Sub
作者:我的好友lonstar
以上在Windows98、ME + VB5、VB6通过。有任何问题欢迎你跟我联系[email protected] 以上代码保存于: SourceCode Explorer(源代码数据库)
复制时间: 2005-11-11 15:19:04
软件版本: 1.0.882
软件作者: Shawls
E-Mail: [email protected]
QQ: 9181729
能有多难,你用这个试试??
Dim fso As New FileSystemObject
fso.CreateFolder ("C:\Documents and Settings\wsk1\「开始」菜单\程序\dfdf")
fso.CreateFolder ("C:\Documents and Settings\wsk1\「开始」菜单\程序\dfdf\qwe1231")要灵活些的话动态获取用户名把wsk1替换就是