To open a folder in VB6

To open a folder in VB6

Page 1 of 1

2 Replies - 5872 Views - Last Post: 06 March 2010 - 11:43 PM Rate Topic: -----

#1 abs1982  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 06-March 10

To open a folder in VB6

Posted 06 March 2010 - 10:35 AM

Hi,

I am using a code to open a folder which is

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

Private Const SW_SHOWNORMAL As Long = 1

Private Sub Command1_Click()
    ShellExecute Me.hwnd, "Open", "C:\TEST\", vbNullString, vbNullString, SW_SHOWNORMAL
End Sub 



But on the shell execute statement after i write Me. , i am not able to select hwnd.

Please let me know how i can get hwnd in the member selection list.

Regards,
Abdul S

Admin Edit: Please use code tags when posting your code. Code tags are used like so => :code:

Thanks,
PsychoCoder :)

Is This A Good Question/Topic? 0
  • +

Replies To: To open a folder in VB6

#2 vb5prgrmr  Icon User is offline

  • D.I.C Lover

Reputation: 109
  • View blog
  • Posts: 1,016
  • Joined: 21-March 09

Re: To open a folder in VB6

Posted 06 March 2010 - 11:41 PM

I don't see why not... But... I can say that, that is a symptom of an error someplace in your code... Meaning, if you have an error somewhere and you type in Me. or Text1. and do not get the list, it is because of that error. I would suggest you use Option Explicit in all your code windows to help prevent things like this...



Good Luck
Was This Post Helpful? 0
  • +
  • -

#3 ram11  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 86
  • Joined: 30-November 08

Re: To open a folder in VB6

Posted 06 March 2010 - 11:43 PM

Not sure wht u are looking for , but if want to see the folder contain & want to open , u can check this


Dim rs As Recordset


Private Sub Command1_Click()
On Error Resume Next
Dim myFSO As New FileSystemObject
Dim myTextStream As TextStream
Dim j As Integer
Set rs = New Recordset
With rs
.Fields.Append "xyz", adBSTR
.Fields.Append "abc", adBSTR

.Open
End With

For i = 0 To File1.ListCount - 1 Step 1
Set myTextStream = myFSO.OpenTextFile(File1.Path & "\" & File1.List(i), ForReading)
j = 0
With rs
.AddNew
Do Until myTextStream.AtEndOfStream
strline = myTextStream.ReadLine
If Trim((Mid(strline, InStr(strline, "=") + 1))) = "" Then
.Fields(j) = "NIL"
Else
.Fields(j) = (Mid(strline, InStr(strline, "=") + 1))
End If

j = j + 1
Loop

.Update
End With

Set DataGrid1.DataSource = rs


Next i

rs.MoveFirst

Do While Not rs.EOF


rs.MoveNext
Loop


End Sub




Private Sub Dir1_Change()
File1.Path = Dir1.Path
File1.Pattern = "*.txt"
End Sub
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1