| View previous topic :: View next topic |
| Author |
Message |
Pepsiguy I post too much
Reputation: 0
Joined: 16 Aug 2007 Posts: 2016
|
Posted: Sat Feb 09, 2008 11:35 pm Post subject: [VB6 Help]Finding files in .swf format |
|
|
Hey, i want to make a swf loader, but i want all my swf files in one swf folder, to be detected in a list box
so say you had Banana.swf in the list box and then u put Apple.swf in it and restart the program, you will see banana and apple .swf
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Feb 10, 2008 12:02 am Post subject: |
|
|
API way:
FindFirstFile
FindNextFile
GetFileAttributes
FindClose
VB6 way: wait till wiccaan finds this.
edit: oops, meant GetFileAttributes. fixed now.
|
|
| Back to top |
|
 |
Buggy Advanced Cheater
Reputation: 0
Joined: 04 Jan 2008 Posts: 72 Location: Republic of Korea (South Korea)
|
Posted: Sun Feb 10, 2008 5:01 am Post subject: Re: [VB6 Help]Finding files in .swf format |
|
|
You might use Dir() or FSO , or FindFirstFile/FindNextFile API.
_________________
[img]
<a><img></a>[/img]
iroo sooo hooooot |
|
| Back to top |
|
 |
AtheistCrusader Grandmaster Cheater
Reputation: 6
Joined: 23 Sep 2006 Posts: 681
|
Posted: Sun Feb 10, 2008 5:58 am Post subject: |
|
|
| Ever used FileListBox?????
|
|
| Back to top |
|
 |
Blader I post too much
Reputation: 2
Joined: 19 Jan 2007 Posts: 2049
|
Posted: Sun Feb 10, 2008 7:36 am Post subject: |
|
|
FSO is a good way to do it, search on how to use it if you don't know how
_________________
|
|
| Back to top |
|
 |
XxOsirisxX Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Oct 2006 Posts: 1597
|
Posted: Sun Feb 10, 2008 11:14 am Post subject: |
|
|
VB 6.0 Example.
Like this???
| Code: | Private Sub Command1_Click()
With CommonDialog1
.Filter = ("Text Files (*.swf | *.swf")
.ShowOpen
If .FileName <> "" Then
List1.AddItem (.FileName)
End If
End With
End Sub |
_________________
|
|
| Back to top |
|
 |
SkeleTron Grandmaster Cheater Supreme
Reputation: 1
Joined: 28 Jun 2007 Posts: 1022
|
|
| Back to top |
|
 |
Blader I post too much
Reputation: 2
Joined: 19 Jan 2007 Posts: 2049
|
Posted: Sun Feb 10, 2008 12:51 pm Post subject: |
|
|
Ok I got my FSO code here:
| Code: | On Error Resume Next
Dim fso As New FileSystemObject
Dim fld As Folder
Dim fil As File
Set fld = fso.GetFolder(App.Path & "\Directory")
For Each fil In fld.Files
List1.AddItem fil.Name
Next
Set fil = Nothing
Set fld = Nothing
Set fso = Nothing |
Gets all items in the "Directory" folder in your application's path, then adds it to a list.
_________________
|
|
| Back to top |
|
 |
XxOsirisxX Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Oct 2006 Posts: 1597
|
Posted: Sun Feb 10, 2008 1:07 pm Post subject: |
|
|
| SciExTron wrote: | That's exactly I wanted to post. Same code with same control.
Like this:
| Code: | Private Sub Command1_Click()
CommonDialog1.Filter = "Shockwave Flash (*.swf)|*.swf|"
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
List1.AddItem (CommonDialog1.FileName)
End If
End Sub |
It does the same thing. Just your code is optimized. |
Yea, i know, just used "With". Which is equal to use..
CommonDialog1.ShowOpen as .ShowOpen
It just applies to all, i suppose you know it. ^^
@ Blader
Somehow, i did try you code, and it just give me an error.
_________________
|
|
| Back to top |
|
 |
Blader I post too much
Reputation: 2
Joined: 19 Jan 2007 Posts: 2049
|
Posted: Sun Feb 10, 2008 1:12 pm Post subject: |
|
|
Oh yeah, I forgot, you need to add microsoft scripting runtime in resources section.
_________________
|
|
| Back to top |
|
 |
XxOsirisxX Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Oct 2006 Posts: 1597
|
Posted: Sun Feb 10, 2008 1:20 pm Post subject: |
|
|
Ty, it works as a charm, also show hidden/system files ^^ it's just great.
+Rep
_________________
|
|
| Back to top |
|
 |
Blader I post too much
Reputation: 2
Joined: 19 Jan 2007 Posts: 2049
|
Posted: Sun Feb 10, 2008 1:26 pm Post subject: |
|
|
Thanks, although it was for the topic starter
Btw, you just got 1337 posts XD
_________________
|
|
| Back to top |
|
 |
Pepsiguy I post too much
Reputation: 0
Joined: 16 Aug 2007 Posts: 2016
|
Posted: Sun Feb 10, 2008 6:08 pm Post subject: |
|
|
| Blader wrote: | | Oh yeah, I forgot, you need to add microsoft scripting runtime in resources section. | how do you do that its not working for me
_________________
|
|
| Back to top |
|
 |
Blader I post too much
Reputation: 2
Joined: 19 Jan 2007 Posts: 2049
|
Posted: Sun Feb 10, 2008 6:11 pm Post subject: |
|
|
Project > Resources then search for it
_________________
|
|
| Back to top |
|
 |
Pepsiguy I post too much
Reputation: 0
Joined: 16 Aug 2007 Posts: 2016
|
Posted: Sun Feb 10, 2008 6:17 pm Post subject: |
|
|
no resources, just references and it says invalid ouside procedure
_________________
|
|
| Back to top |
|
 |
|