/[cvs]/joko/ToolBox/Windows/HylaPrintMon_MapiContactsDumper/ModuleUtils.bas
ViewVC logotype

Contents of /joko/ToolBox/Windows/HylaPrintMon_MapiContactsDumper/ModuleUtils.bas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Mon Sep 3 18:35:03 2007 UTC (16 years, 10 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +19 -0 lines
minor enhancements

1 Attribute VB_Name = "ModuleUtils"
2 ' (c) Andreas Motl <andreas.motl@ilo.de>, 2007-09-01
3
4 Option Explicit
5
6 ' Access the GetUserNameA function in advapi32.dll and call the function GetUserName.
7 Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
8
9 Public Sub slog(logString As String)
10 'Text1.Text = Text1.Text & logString & vbCrLf
11 DoEvents
12 End Sub
13
14 Public Function DirectoryExists(Dir As String) As Boolean
15 Dim oDir As New Scripting.FileSystemObject
16 DirectoryExists = oDir.FolderExists(Dir)
17 End Function
18
19 Public Function getCmdArg(name As String) As String
20
21 Dim args() As String
22 args = Split(Command$, " ")
23
24 Dim i As Integer
25 'MsgBox UBound(args)
26 For i = 0 To UBound(args)
27 'MsgBox i & ": " & args(i)
28 If args(i) = name Then
29 getCmdArg = args(i + 1)
30 'i = i + 1
31 Exit Function
32 End If
33 Next
34
35 End Function
36
37 ' via: http://support.microsoft.com/kb/q152970/
38 Function Get_User_Name() As String
39
40 ' Dimension variables
41 Dim lpBuff As String * 25
42 Dim ret As Long, UserName As String
43
44 ' Get the user name minus any trailing spaces found in the name.
45 ret = GetUserName(lpBuff, 25)
46 Get_User_Name = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
47
48 End Function
49

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed