How to open files in my local machine.

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jul 2007
Posts: 113
Reputation: jaasaria is an unknown quantity at this point 
Solved Threads: 1
jaasaria's Avatar
jaasaria jaasaria is offline Offline
Junior Poster

How to open files in my local machine.

 
0
  #1
Aug 6th, 2009
Hi guys .. i wanted to open some of my files. like mswords that save in any of my folders. also wanted to open .txt, .jpg, html etc files.

any code for this..

i have an idea using

shell "location of exe"

but it open exe files only. i wanted to open/preview some of my documents.. any help will be much appreciated.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 97
Reputation: manoshailu is an unknown quantity at this point 
Solved Threads: 10
manoshailu's Avatar
manoshailu manoshailu is offline Offline
Junior Poster in Training

Re: How to open files in my local machine.

 
1
  #2
Aug 6th, 2009
hi,
Try the following code:

[CODE]

'Declare the function to open any type of file

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long


'Declare the variable of FileSytemObject to handle the files
'To get the filesystemobject select the Reference "Microsoft Scripting Runtime"

Dim f As New FileSystemObject
Private Sub Command1_Click()
CommonDialog1.ShowOpen

'To Open the Selecte File

Text1.Text = CommonDialog1.FileName
OpenLocation (gParam_value & Text1.Text)
End Sub


'To Open the Selecte File

Private Function OpenLocation(ByVal WhichFilePath As String, Optional sParams As String = "", Optional sStartIn As String = vbNullString, Optional lngOpenMode As Long = 1) As Long
OpenLocation = ShellExecute(0, "Open", WhichFilePath, sParams, sStartIn, lngOpenMode)
End Function


Have a Great Day
Shailaja



Originally Posted by jaasaria View Post
Hi guys .. i wanted to open some of my files. like mswords that save in any of my folders. also wanted to open .txt, .jpg, html etc files.

any code for this..

i have an idea using

shell "location of exe"

but it open exe files only. i wanted to open/preview some of my documents.. any help will be much appreciated.
Last edited by manoshailu; Aug 6th, 2009 at 8:29 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 113
Reputation: jaasaria is an unknown quantity at this point 
Solved Threads: 1
jaasaria's Avatar
jaasaria jaasaria is offline Offline
Junior Poster

Re: How to open files in my local machine.

 
0
  #3
Aug 8th, 2009
perfect codes, for what i looking for.

thxx a lot manoshailu.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC