-
Well i am having some trouble, i am a basic newbie to vb, but i know how to do everything for this program accept one part.
What this program is for is a game, it is suppose to switch the mods around quickly and easily. With the installer i have made up the program is only being installed to one specific location but the game unfortunatly can be placed in any folder. In order for this program to work properly it needs to know that folder. The program will be taking files from its installed location and switching them with the files in the game location. But how exactly do i make it so the program knows where that specific location is?
Sorry if my question is confusing but it is hard to explain by typing.
Thanks for the help,
-
Have you tried using app.path? Instead of hardcoding where the files are located, this is a way of vb telling the program where to look.
-
You can use
App.Path
or use api function GetFullPathName to retrive your program's path.
-
So then what exactly would i do?
Like i said its kind of hard as me being a newbie :(
But if i use the GetFullPath, then i need it to remember that path and use that value in the program.
So if it was for say
D:\Program Files\WestWood\Dune2000\Data
If it found the file there, then i would need it to remember that path so it could switch the stuff around. What exactly does the API do...?
I apreciate the help!
-
if u put in a command button:
stringpath = app.path
then you would get the directory of wherever the program is in ... so then you can use "stringpath" to tell ur program where to move the files ...
-
Like this?
I think he needs to swap files with a game that may already be on the users computer. The easiest way I can think of would be to install your program to the same folder as the game. You should be able to do this with the browse button on install. Then you could use the App.Path to do the swapping.
Code:
'this is just an idea, not tested
'if you install to D:\Program Files\Dune
MyData = App.Path & "\Data\whatever"
Does that help?
[Edited by kokopeli on 11-21-2000 at 11:46 PM]
-
Ok so what exactly do i do with the App.path?
Or is that just an unset variable? Because some how the thing needs to find the app path. But the idea of having them install it to the same directory as the game is good because then you could just start doing things like \...
But then i go back to the problem of does App.Path know the directory in which the program was installed? See personally, i don't know what App.Path even is since im a newbie :( I figure it stand for Application path. But the thing that still confuses me is how do you get it to search for that application or how do you get it so it sets the application value?
I really appreciate the help!!
Thanks,
-
Actually Dreys your making me very confused. Your talking about the game location (or path) and the application location. Isn't the application the game?
When the user starts your application (the game?) the App.Path does return the path to the application.
Could you be more specific and maybe describe an example of what your trying to do.
Best regards
-
?
Hi Dreys,
not really sure what you want, hope this helps. When using the command App.Path this returns a sting, like "c:\Program Files\YourGame".
This path is where your MAIN EXECUTABLE is located, so where yourgame.exe is located.
-
OK..Let's assume you have a program you are running in "C:\Windows\CyberSurfer". You could detect this path from within your program using App.path:
Code:
dim path as string ' The variable we will use to hold tha Applications Path
path = App.Path ' path now has the value "C:\Windows\CyberSurfer"
That's all you have to do!
Hope this was of some help! I found this very confusing first time round as well!!
[Edited by CyberSurfer on 11-22-2000 at 06:55 AM]
-
Ok so i think i have it now. For the question on what exactly im trying to do, i am trying to make it switch diffrent folders. Ok so lets say the program is installed on D
Then i would use the code:
(Code from Cyber Surfer)
dim path as string ' The variable we will use to hold tha Applications Path
path = App.Path ' path now has the value "C:\Windows\CyberSurfer"
Then it would know the directory that the game was in? So then what my program needs to do is take the files from its directory and swap it with the files from the games directory. So would i do something like.
Shell ("c:\windows\command\xcopy /e /i /r App.Path\Data \Data\Bin"), vbHide
Where as my program was placed in the same directory as the game so i can just use the locate \.. to go up and accross etc. Well that is the code that im using to copy the stuff into the other directory. I am pretty sure that when i used app.path it probably messed the code above up. But when i was testing the thing to see if my code would even actually work. Since the game for me is on the c drive i used it like this just to test:
Shell ("c:\windows\command\xcopy /e /i /r c:\WestWood\Dune2000\Data\Bin \WestWood\Dune2000\Data\Original Dune Mod"), vbHide
Which made a backup of the original mod. I almost have this thing done and figured out but i don't exactly how i would imput this into the program....
Thanks!
-
Sorry if I'm butting in but it sounded like you may have been confused about what App.Path is/does.
Make a new standard exe in vb and put this code behind a command button,
Private Sub Command1_Click()
MsgBox App.Path
End Sub
This will show you what App.Path does.
Again, sorry if I'm intruding, just trying to help.
JO
-
I understand really well now what app.path does, but what im trying to do now is figure out how to use the App.Path call to be able to copy files from the program directory to the game directory... I have a easy idea on how to do it but i only know how to use the shell DOS command to copy the file. I don't know how to make it work with the App.Path..
-
i forgot the exact syntax but once u get the path of ur prog and the game you have to use the file copy command
i think it goes like:
filecopy(source file, destination file)
that's how you would copy stuff