Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Visual Basic


  • Please log in to reply
6 replies to this topic

#1 KamakaZ

KamakaZ

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:11:26 PM

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.

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.


BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:06:26 AM

Posted 23 March 2009 - 05:29 PM

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.

#3 KamakaZ

KamakaZ
  • Topic Starter

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:11:26 PM

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...

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 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:06:26 AM

Posted 23 March 2009 - 10:20 PM

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.

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.

#5 Romeo29

Romeo29

    Learning To Bleep


  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:07:26 AM

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 KamakaZ

KamakaZ
  • Topic Starter

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:11:26 PM

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.

Edited by KamakaZ, 23 March 2009 - 11:51 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 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:06:26 AM

Posted 24 March 2009 - 06:55 AM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users