vb 创建快捷方式 兼容vista XP
'创建快捷方式,兼容vista
'要把vb6stkit.DLL放到程序目录
'敖士伟 09-10-27
'只对“桌面”和“开启”有效,其它还没做
'=========开启外部同步程序定义开始
Const SYNCHRONIZE = &H100000
Const INFINITE = &HFFFF 'Wait forever
Const WAIT_OBJECT_0 = 0 'The state of the specified object is signaled.
Const WAIT_TIMEOUT = &H102 'The time-out interval elapsed, and the
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
'=========开启外部同步程序定义结束
'创建快捷方式
Private Declare Function fCreateShellLink Lib "vb6stkit.DLL" ( _
ByVal lpstrFolderName As String, _
ByVal lpstrLinkName As String, _
ByVal lpstrLinkPath As String, _
ByVal lpstrLinkArgs As String, _
ByVal fPrivate As Long, _
ByVal sParent As String) As Long
'
'lpstrFolderName 文件夹的名称 “$(proprams)” 程序组 "$(Strar Menu)" 开始菜单
'lpstrLinkName 快捷键的名称
'
'lpstrLinkPath 快捷键的路径
'
'lpstrLinkArgs 这里是命令行参数
'
'fPrivate True
'
'sParent 上一层文件夹
'快捷方式中的常数
Public Enum ShortCutPosition
vbDesktop = 1 '桌面
vbStart = 2 '启动项
vbStartMenu = 3 '开始菜单程序项
vbGroup = 4 '开始菜单顶端
End Enum
'开启外部同步程序过程
Private Sub cmdShell(s_cmd As String)
Dim lPid As Long
Dim lHnd As Long
Dim lRet As Long
lPid = Shell(s_cmd, vbNormalFocus)
If lPid <> 0 Then
lHnd = OpenProcess(SYNCHRONIZE, 0, lPid) 'Get a handle to the shelled process.
If lHnd <> 0 Then 'If successful, wait for the
lRet = WaitForSingleObject(lHnd, INFINITE) ' application to end.
CloseHandle (lHnd)
相关文档:
VB颜色和RGB色互相转换头疼了我好一段时间,如今找到解决办法了
特别贴出来与大家共享
Type RGB
Red As String
Green As String
Blue As String
End Type
Public Function ColorToRGB(ByVal dwColor As Long) As RGB
Dim clrHex ......
http://tieba.baidu.com/f?kz=255370663
搜集到一个程序
几乎都用它来完成采集任务了!贡献出来啊,很简单滴
Function strCut(strContent, StrStart, StrEnd) As String '通用截取函数
Dim strHtml, S1, S2 As String
dim strstart,stren ......
无意中发现VB For循环的一个特点:在循环体中,企图改变循环终止变量使之提前退出循环是徒劳的。
Private Sub Form_Load()
Dim s(0 To 4) As String
Dim N As Integer, i As Integer
s(0) = "测试1"
s(1) = "测试2"
s(2) = "测试3"
s(3) = "测试4"
s(4) = "测试5 ......
http://zhidao.baidu.com/question/81532606.html
VB 读指定行
悬赏分:10 - 解决时间:2009-1-20 11:41
vb中如何读取指定行的内容,窗体上有两个标签,文件在C:\A.TXT,四个按钮,单击第一个,读文件的第一行到标签一,第二行到标签二;单击第二个按钮,第三行到标签一,第四行到标签二;以此类推,谢谢
提问者: im ......