Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Monday, June 27, 2011

VB-24 : Copies files from one location to other

Create an application,that copies a file from one location to any other location by simulating windows explorer(That is,implementing drag and drop feature).


Steps:

  1. Start VB
  2. Click DriveListBox control on the form(Note that, by default,its name is Drive1).Now stretch the form length
  3. Add another component DirListBox (by default,its name is Dir1).
  4. Repeat steps (2) and (3) and we get the controls with the names  Drive2 and Dir2
  5. Note that now there is two DriveListBox and two DirListBox.
  6. Insert a FileListBox  (by default,its name is File1).
  7. Now,our aim is to implement the copy operation,when we drag a file from File1 and drop it in  Dir2 . So ,to do this  the following steps are needed ..,after writing the code..


Attaching Code to the Object :




Private Sub Dir1_Change()
File1.Path = Dir1
End Sub
Private Sub Dir2_DragDrop(Source As Control, X As Single, Y As Single)
Dim st As String
st = "\" And Source.Path And st 'dir2.Path and st
Source.Drag 0
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1
End Sub
Private Sub Drive2_Change()
Dir2.Path = Drive2
End Sub
Private Sub File1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
File1.DragIcon = LoadPicture("c:\program files\microsoft visual studio\vfp98\-tools\filer\filer.ico")
If Button = 1 Then
File1.drag1
End If
End Sub



=========================================================================
Back to Home   &  VB

VB-23 : Simple Animation using ActiveX

Program for implementing a small animation clip in an application :


Steps:


  1. Start VB
  2. Project --> Components (Ctrl T)
  3. Add a component file comct232.ocx to the project from control tab in the window.(Select "Microsoft windows common controls-2.5.0(SP2))
  4. Apply-OK
  5. We will get two new controls in the tool box(up-down control and animation control)
  6. Now, add the animation control in our form
  7. Add two command buttons in our form and set their caption property as Play and Stop
  8. Again , Project --> Components (Ctrl T)
  9. Add a component file comdlg32.ocx to the project from control tab in the window.(Select "Microsoft common dialog controls-6.0(SP6))
  10. Apply-OK
  11. Now, add this new control in our form.
Now run the program and you will get the following screen.


(The other two controls Animation and CommonDialog will not appear on the screen while running)


Attaching Code to the Object :



Private Sub Command1_Click()
CommonDialog1.Filter = "*.AVI"
CommonDialog1.ShowOpen
Animation1.Open CommonDialog1.FileName
Animation1.Play
End Sub
Private Sub Command2_Click()
Animation1.Stop
End Sub


Output :


When you press PLAY , a screen will appear ,open any file with AVI format.And you will get the same loaded form with a new running animation file which you have choosen.
To stop animation,you can press STOP button.


(Refer this Video explaining a simple animation)
=========================================================================
Back to Home   &  VB