Olenpa tässä miettinyt, kun tein omaksi huvikseni yksinkertaisen (ja ehkä hieman "purkkaviritelmä") kiusaohjelman, ja haluaisinkin nyt tietää kuinka tämän ohjelman saisi "listaamaan" käyttäjän konella olevat tiedostot? Siis tarkoitan kuten poistaessa windowsissa näyetään poistettavat tiedostot.
Tässä koodi
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Dim sekunti As Long
Dim minuutti As Long
Private Sub Form_Load()
App.TaskVisible = False
Animation1.Open App.Path & "\poisto.avi"
Animation1.Play -1
sekunti = 59
minuutti = 1
ProgressBar1.Value = 0
X = SetWindowPos(hWnd, -1, 0, 0, 0, 0, (2 Or 1))
End Sub
Private Sub Timer1_Timer()
End Sub
Private Sub Form_Unload(Cancel As Integer)
Cancel = 1
End Sub
Private Sub Timer2_Timer()
If ProgressBar1.Value < 100 Then
ProgressBar1.Value = ProgressBar1.Value + 1
Else
MsgBox "Format c:\ Complete", vbInformation, "Complete"
Timer2.Enabled = False
X = ExitWindowsEx(0, dwReserved)
End If
End SubDirillä, jos nyt tajusin oikein :P
Tee listalaatikko ja kokeile:
filu = Dir("c:\") 'vaihda polku siihen mitä haluat
While filu <> "" 'etsitään kaikki filut
ListBox1.AddItem filu 'lisätään listalaatikkoon filu, tässä voit tehdä filulle vaikka mitä muutakin
filu = Dir 'seuraava filu
WendAihe on jo aika vanha, joten et voi enää vastata siihen.