vb获得自身名称/不用APP?
如下我获得了自身路径,获得名称用什么函数?api也可以,不要用vb自带的app属性SetobjShell=CreateObject("Wscript.Shell")Msg...
如下我获得了自身路径,获得名称用什么函数?api也可以,不要用vb自带的app属性
Set objShell = CreateObject("Wscript.Shell")
MsgBox objShell.CurrentDirectory 展开
Set objShell = CreateObject("Wscript.Shell")
MsgBox objShell.CurrentDirectory 展开
展开全部
Private Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineA" () As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByVal Destination As String, ByVal Source As Long, ByVal Length As Long)
Private Sub Form_Load()
Dim lRet As Long, sCmd As String
lRet = GetCommandLine
If lRet > 0 Then
sCmd = String(256, 32)
CopyMemory sCmd, lRet, Len(sCmd)
sCmd = Mid(sCmd, 1, InStr(1, sCmd, Chr(0)) - 1)
MsgBox sCmd
End If
End Sub
路径和文件名都有!
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByVal Destination As String, ByVal Source As Long, ByVal Length As Long)
Private Sub Form_Load()
Dim lRet As Long, sCmd As String
lRet = GetCommandLine
If lRet > 0 Then
sCmd = String(256, 32)
CopyMemory sCmd, lRet, Len(sCmd)
sCmd = Mid(sCmd, 1, InStr(1, sCmd, Chr(0)) - 1)
MsgBox sCmd
End If
End Sub
路径和文件名都有!
更多追问追答
追问
sCmd = Mid(sCmd, 1, InStr(1, sCmd, Chr(0)) - 1)
这一句什么意思啊?
追答
就是截取sCmd的一段,它保存的路径是以asc码为0来结尾的,后面还有其他字符。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询