Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > how to open a flash drive..


Reply
 
Thread Tools Display Modes
  #1  
Old 08-07-2008, 01:46 AM
rhye's Avatar
rhye rhye is offline
Centurion
 
Join Date: Aug 2006
Location: Pampanga, Philippines
Posts: 153
Default how to open a flash drive..


hi, how to open a flash drive using vb6? I mean is that when I click button open will launched the files on my flash drive or inserted flash drive.tnx
__________________
I don't know what I'm doing here. I just want to learn little bit out of my busy life.
Reply With Quote
  #2  
Old 08-07-2008, 06:29 AM
mkaras's Avatar
mkaras mkaras is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Mar 2004
Location: Beaverton, OR
Posts: 1,874
Default

You will have to provide some more details of just what you mean by "open" the flash drive. Be more specific about the operating scenario that you are wanting to realize. Here are some things to think about:

- Is the program that has the button you intend to click already running when the flash drive is inserted?

- Are you envisioning that the program would be able to detect automatically when the flash drive is or becomes present?

- Have you looked into the "Autorun" feature of Windows?
Reply With Quote
  #3  
Old 08-07-2008, 07:27 AM
rhye's Avatar
rhye rhye is offline
Centurion
 
Join Date: Aug 2006
Location: Pampanga, Philippines
Posts: 153
Default

flash drive is already inserted and when I run my program it will launch the files of the flash drive.
__________________
I don't know what I'm doing here. I just want to learn little bit out of my busy life.
Reply With Quote
  #4  
Old 08-07-2008, 07:54 AM
mkaras's Avatar
mkaras mkaras is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Mar 2004
Location: Beaverton, OR
Posts: 1,874
Default

If the content on the flash drive is executable then just have your program use the ShellExecute() method. You can search here or in MSDN to see how to launch an external process with this.

I use this type of thing all the time to start an external program to leverage other programs capabilities to enhance the functionality of mine. Common programs used are Notepad and Excel.
Reply With Quote
  #5  
Old 08-07-2008, 08:10 AM
rhye's Avatar
rhye rhye is offline
Centurion
 
Join Date: Aug 2006
Location: Pampanga, Philippines
Posts: 153
Default

Code:
[AutoRun]
ShellExecute=file.exe
the one I want to accomplish is when I open my flash drive it loads the .exe file and the same time it opens the drive itself.
__________________
I don't know what I'm doing here. I just want to learn little bit out of my busy life.
Reply With Quote
  #6  
Old 08-08-2008, 02:32 PM
unclebill unclebill is offline
Junior Contributor
 
Join Date: Apr 2003
Location: San Diego, CA
Posts: 301
Default

Being unsure what you mean by ". . .opens the drive itself." I suspect you may mean opening a Windows Explorer window and displaying the contents of the flash drive.

If that's the desired result, add the command line:

explorer [pathname]

to your autorun file.

Supply the appropriate [pathname] to direct Explorer to your flash drive.
Reply With Quote
  #7  
Old 08-09-2008, 06:43 AM
rhye's Avatar
rhye rhye is offline
Centurion
 
Join Date: Aug 2006
Location: Pampanga, Philippines
Posts: 153
Default

here: [autorun]
icon=welcome.exe
open=welcome.exe
label=Welcome
action=Show Welcome
shell\open\command=welcome.exe

I dont think if this is correct.
__________________
I don't know what I'm doing here. I just want to learn little bit out of my busy life.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->