|
-
Aug 2nd, 2006, 04:14 AM
#1
Thread Starter
Fanatic Member
[Resolved]AHH!!! What's going on here! app.*
When i have this msgbox come up in VB, it says
VB Code:
MsgBox "Location: " & App.path & "\" & App.EXEName & ".exe"
Says: "C:\VB\MyApp\MyProgram.exe"
When i compile it, it then says "C:\VB\MyApp\\MyProgram.exe"
But if i put this code in
VB Code:
MsgBox "Location: " & App.path & App.EXEName & ".exe"
VB says "C:\VB\MyAppMyProgram.exe"
But compiling it says "C:\VB\MyAppMy\Program.exe"
What's going on here!
It's taken me ages to figure this out, i'm trying to have a program copy itself to a location on the harddrive (such as programfiles) because it rights to the registery to start it self up with windows, and the control panel needs a location for the program (i have an option in control panel. I can post my entire project here if you want, but i think it will take too long for any of you to go through. So if you can tell me which one of these msgboxes are liars, or another way to fix this problem.
Thanks!
Last edited by Slyke; Aug 2nd, 2006 at 04:32 AM.
-
Aug 2nd, 2006, 04:18 AM
#2
PowerPoster
Re: AHH!!! What's going on here! app.*
MsgBox "Location: " & App.path & "\" & App.EXEName & ".exe"
works for me ... whats the app's actual folder when compiled ?
-
Aug 2nd, 2006, 04:24 AM
#3
Thread Starter
Fanatic Member
Re: AHH!!! What's going on here! app.*
VB Code:
MsgBox "Location: " & App.path & "\" & App.EXEName & ".exe"
In VB:
Path: C:\Program Files\Microsoft Visual Studio\VB98\Drive Backup\Drive Back Up.exe
Compiled to an Exe:
Path: C:\Temp\\DriveBackup.exe
VB Code:
MsgBox "Location: " & App.path & App.EXEName & ".exe"
In VB:
Path: C:\Program Files\Microsoft Visual Studio\VB98\Drive BackupDrive Back Up.exe
Compiled to an Exe:
Path: C:\Temp\DriveBackup.exe
-
Aug 2nd, 2006, 04:29 AM
#4
PowerPoster
Re: AHH!!! What's going on here! app.*
the first one is the right one, make a new exe just with that msgbox and test it. i just tried in c:\temp and made an exe called DriveBackup.exe, ran it from there and it was correct.
-
Aug 2nd, 2006, 04:29 AM
#5
Re: AHH!!! What's going on here! app.*
VB Code:
Public Function FixPathFile(ByVal Path As String, File As String) As String
If Right$(Path, 1) <> "\" Then
FixPathFile = Path & "\" & File
Else
FixPathFile = Path & File
End If
End Function
VB Code:
MsgBox "Location: " & FixPathFile(App.path, App.EXEName & ".exe")

Edit
Btw, root of drives, such as C:\ and D:\, always have the \ character in the end. The only reliable way is to check if the \ character exists in the end of the path string.
-
Aug 2nd, 2006, 04:31 AM
#6
Thread Starter
Fanatic Member
-
Aug 2nd, 2006, 04:35 AM
#7
PowerPoster
Re: [Resolved]AHH!!! What's going on here! app.*
no prob .. maybe leave it in then use ..
Dim sApp As String
sApp = Replace(App.Path & "\" & App.EXEName & ".exe", "\\", "\")
MsgBox "Location: " & sApp
-
Aug 2nd, 2006, 05:42 AM
#8
Thread Starter
Fanatic Member
Re: [Resolved]AHH!!! What's going on here! app.*
Yes, i'm using your code any way from now on, thanks for this!
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
|