
正文
包含vbnet创建快捷方式的词条
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
vb.net怎么设置快捷键
新建一个Form1把Form1vbnet创建快捷方式的KeyPreview改成True
拖入一个Button1到Form1上面
然后加入以下代码
Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
If e.KeyData = (Keys.Alt Or Keys.G) Then
Button1.PerformClick() '或者用Button1_Click(Nothing, New EventArgs)
'快捷键Alt+G触发Button1_Click()事件。
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Button1.Size = New Size(180, 23)
Button1.Text = "vbnet创建快捷方式我被局部快捷键给召唤vbnet创建快捷方式了~"
End Sub
相关问答
Q1: 如何用VB给指定文件创建桌面快捷方式
vb创建快捷方式有以下几种方法:
1、用fCreateShellLink函数,此方法用户电脑必须有STKIT432.DLL文件。
Private Declare Function fCreateShellLink Lib "STKIT432.DLL" (ByVal lpstrFolderName AsString, ByVal lpstrLinkName As String, ByVal lpstrLinkPath As String, ByVal lpstrLinkArgs As String) As Long Sub
private Command1_Click()
Dim lReturn As Long
lReturn = fCreateShellLink("..\..\Desktop", "Shortcut to Calculator", "c:\windows\calc.exe", "")
End Sub
2、比较常用的是用WshShell对象创建快捷方式,此方法依赖\system32\WSHom.Ocx文件,部分电脑可能关闭了此文件权限,所以用的时候可根据错误,自动注册该组件
Dim nPath As String, sh, ShortCut
on error resume next
Set sh = CreateObject("wscript.shell")
If Err = 429 Then'判断用户电脑是否禁用了WshShell,如果禁用重新注册这个组件
Dim oca As String
oca = Environ("Windir") "\system32\WSHom.Ocx"
If Dir(oca) = "" Then Exit Function
Shell "regsvr32 """ oca """ /s"
Err = 0
Set sh = CreateObject("wscript.shell")
End If
nPath = sh.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop")'获取当前用户的桌面目录
If Right(nPath, 1) "" Then nPath = nPath "\"
ShortF = nPath "文本文档.lnk"
Set ShortCut = sh.CreateShortcut(ShortF) '开始创建快捷方式对象
ShortCut.TargetPath = "C:\123.exe" '快捷方式指向的目标文件,写完整路径
ShortCut.Save
3、自己写快捷方式创建控件。此方法代码比较繁琐,网上也有相关实例代码,也是可以参考的一种方式。
Q2: 在VB。NET中怎么样给按钮添加快捷键
如果是用Alt组合健,最简单vbnet创建快捷方式的方法就是,在按钮的Text属性里加个符合,比如想用Alt+A来控制Button1的话,就在Button1的Text属性上加一个A即可。比如Text属性是“vbnet创建快捷方式我是按钮(A)”,如图所示,那么在按下Alt+A就可以执行Button1_Click命令了,呵呵
Q3: vb.net的安装和部署的快捷方式问题
某某.exe”程序集,选择“创建某某.exe的快捷方式”,修改成你要的名称。
2.选择“创建某某.exe的快捷方式”属性:Icon(表示快捷方式图标),选择“浏览”弹出“图标”窗体:
添加ico图标
3.选择“创建某某.exe的快捷方式”属性:Folder(表示 在哪里的快捷方式)。弹出“选择文件夹”窗体:
“用户桌面”表示:在桌面上的快捷方式;
“用户的‘程序’菜单”表示:在开始菜单中的快捷方式
小弟表达能力不行,如果兄弟不明白,俺给你抓图,程序打包我也搞了好几天
Q4: vb创建快捷方式
给你一个简单的:
Private Sub Command1_Click()
Dim WshShell As Variant, oMyShortcut As Variant
Set WshShell = CreateObject("Wscript.shell")
Set oMyShortcut = WshShell.CreateShortcut(App.Path "\新建文件夹\窗口化.lnk") '此处为快捷名称
'oMyShortcut.IconLocation = "" '此处为快捷图标
oMyShortcut.TargetPath = App.Path "\新建文件夹\窗口化.exe" '此处为目标文件
'oMyShortcut.Hotkey = "ALT+CTRL+C" ''此处为快捷热键
oMyShortcut.Save
MsgBox "OK"
End Sub
Q5: vb.net怎么写代码给指定的硬盘里的文件创建桌面快捷方式
简单啊,可以调用命令行,不要死脑筋哦
[InternetShortcut] "E:\guiminer.url"
URL="E:\guiminer.exe" "E:\guiminer.url"
IconIndex=0 "E:\guiminer.url"
IconFile="E:\guiminer.exe" "E:\guiminer.url"
关于vbnet创建快捷方式和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。








