|
-
May 29th, 2000, 12:10 AM
#1
Thread Starter
New Member
Hi all!
I'm relatively new to VB and I've just started my first major application but I've run into a problem. Is there a way to find out the working directory, ie. the directory containing the application? I've tried using CurDir() but if the program isn't in the current directory then it doesn't work properly.
Thanks in advance for any help,
Greg Nolle.
-
May 29th, 2000, 12:22 AM
#2
Fanatic Member
A simple little function by the name of
-
May 29th, 2000, 12:23 AM
#3
I believe you are looking for App.Path
-
May 29th, 2000, 12:33 AM
#4
_______
Another Approach I Found Somewhere.
Public Const MAX_PATH = 206
Public Declare Function GetModuleHandle Lib _
"kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) _
As Long
Public Declare Function GetModuleFileName Lib _
"kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Long, _
ByVal lpFileName As String, ByVal nSize As Long) As Long
'App.Path is not always reliable, especially on a network.
'Try using GetModuleFileName API call to avoid the problem
Dim lngFileHandle As Long
Dim lngReturn As Long
Dim strFilePath As String
strFilePath = Space$(MAX_PATH)
lngFileHandle = GetModuleHandle(App.EXEName)
lngReturn = GetModuleFileName(lngFileHandle, strFilePath, MAX_PATH)
MsgBox strFilePath
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
May 29th, 2000, 12:55 AM
#5
Thread Starter
New Member
Thanks all of you for your help. App.Path worked perfectly since I don't need it to work on a network.
Thanks again,
Greg.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|