BleepingComputer.com: Visual Basic

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Visual Basic

#1 User is offline   KamakaZ 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 557
  • Joined: 26-August 08
  • Gender:Male
  • Location:Victoria

Posted 23 March 2009 - 04:57 PM

Trying to find out what the running path of the application is, the i have a command that opens an .exe when a button is clicked. Using that command i have to specify a filepath to the .exe, i have been using "C:\drivers\filename.exe" up until now.

This program is going to be on a cd though, so the drive letter it goes into will vary per PC.

is it possible to have the program return it running path, then use the running path in the button clicked command such as

"<Running_path>:\drivers\filename.exe"

Hope this makes sense.
If I am helping you and don't reply in 24 hours please send me a PM

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.

#2 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,605
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 23 March 2009 - 05:29 PM

Quote

is it possible to have the program return it running path, then use the running path in the button clicked command such as

Even if it could, how would the program know when to do this? You would have to somehow query the program, which means that you would have to know where it is ahead of time. ;)
The thing to do would be to see if the file exists in it's default location. If it doesn't, then problem solved. If not, then you will have to open a file dialof window so that the user can manually find the application themselves.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#3 User is offline   KamakaZ 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 557
  • Joined: 26-August 08
  • Gender:Male
  • Location:Victoria

Posted 23 March 2009 - 09:50 PM

Im trying to make a program the open's a file, either .avi or .exe, when a button is clicked...

This will be put onto a cd. The cd drive letter changes with each pc. It'd be good if you could use something like in html like "./drivers/filename.exe".

I'm trying to create a mulitple .exe installer that gives the user the chioce of which driver to install, runs the drivers setup program (.exe) and the finishes, nothing fancy.

Can you see any work around for this?

I did set up a batch file that copied the "drivers" folder to the C: (which is the same on all windows PC's), problem was that UAC didn't like this, where XP worked beautiful. So when the CD was inserted, it would run the batch file via the autorun, and copy the files, call the setup.exe (visual basic program) then when the program was terminated it would delete the drivers folder and finish.

Not the best way to do it i know...
If I am helping you and don't reply in 24 hours please send me a PM

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.

#4 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,605
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 23 March 2009 - 10:20 PM

Quote

The cd drive letter changes with each pc

Not quite sure I follow you there. Why would it change? I can't see why not simply getting the root directory wouldn't solve your problem; your application shouldn't care what the drive letter is. It should just look for the base, and install from there.

Quote

problem was that UAC didn't like this
Well, everybody griped about XP not being secure, so this is what we have to work with in Vista. The UAC is not going to prevent an application from installing; it just forces the user to pay attention.

Regardless, I think you may be making this harder than it needs to be (or I am completely missing the problem) . You have a file to install, and you want the user to be able to choose where to install it. you use a file dialog to allow the user to select the location. Again, there is no need to even care what the drive letter is.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#5 User is offline   Romeo29 

  • Learning To Bleep
  • PipPipPipPipPipPip
  • Find Topics
  • Group: BC Advisor
  • Posts: 2,834
  • Joined: 06-July 08
  • Gender:Not Telling
  • Location:127.0.0.1

Posted 23 March 2009 - 11:20 PM

If your VB app (for example, app.exe) is in same folder as the program you want to run (for example, file.exe) then u dont have to specifiy path, just execute "file.exe" straight.

You can find the VB application's path using "Application.ExecutablePath" in vb.net and using "App.Path" in vb6.0. Then use string functions on this path to achieve your goal.

#6 User is offline   KamakaZ 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 557
  • Joined: 26-August 08
  • Gender:Male
  • Location:Victoria

Posted 23 March 2009 - 11:47 PM

I am using visual basic 2008 express, i could put the files in the one location, although i'd rather have it organised so the folder structure looks like this:

- Setup.exe (vb program)
- Drivers
- filename.exe
- Video
- filename.exe

Which command would i use in the version mentioned above? and would it work with the structure i've listed above?

sorry groovicus, i mean i have multiple .exe's, the user is to choose ONE .exe, via clicking a button, and then visual basic should pass over to the .exe, the end.

I'm putting the finished project onto a CD. So when a user puts the CD into their computer, the CD drive has a drive letter. This drive letter changes on a per PC basis, i might have it as D: where as you might have it as E: etc... so using a fully qualified path won't work.

This post has been edited by KamakaZ: 23 March 2009 - 11:51 PM

If I am helping you and don't reply in 24 hours please send me a PM

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.

#7 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,605
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 24 March 2009 - 06:55 AM

Quote

so using a fully qualified path won't work.

Which is why you don't use a fully qualified path, as I have been saying.

Relative paths
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users