Programmers

 

 

 

This page is dedicated to the free exchange of software, ideas, and information. If you have suggestions, comments or criticism about this page, or ideas about how it can be more useful, please Email me

 

Everybody is invited to share their own VB tips and tricks .

 

Table of Contents

Tips and Tricks(for VB programmers)

Downloads(Source codes, VB programs )

Acknowledgements

 

Trips and Tricks(Visual Basic)

 

  1. Making forms independent of resizing(Intermidiate)

  2. Adding cool things to forms(Beginners)

  3. WAV or MIDI files using the MCI (Media Control Interface API)(Intermidiate)

 

 

 

 

 

 

 

Making forms independent of resizing

What will happen if you design a form on a 640X480 Resolution and the  screen is adjusted to 1024X780?

The proportions of the form and controls change, right? if the monitor is too small, they may be far too tiny!

Heres the solution to this problem.

Dealing with screen resolution changes

Me.Height=Screen.height/2

me.width=screen.width/2

me.top=(screen.height/2)-(me.height)/2

me.left=(screen.width/2)-(me.left)/2

This will make the form centered, dimension half of the screen regardless of resolution

Its up to you now to decide on where and what size you want your form to be relative to the screen size.

Tip: just think of the form as having certain proportions relative to the screen.

                                                                Back to top

 

 

 

 

 

 

Want those 3D underline on menus just like those in Visual C++ . Follow these steps:

  1. PPlace a frame control on a form. Set the caption to none, height to 30.

  2. in the form load() place this

                        frame1.width=screen.width+100

                        frame1.move-50,0

     Run the program and see.          Back to top

 

 

 

 

 

 

 

 

This program  implements an interface for dealing with the WAV or MIDI files using the MCI (Media Control Interface) API


To try this example, do the following:
1. Create a new form
2. Add a command button called 'cmdPlay'
3. Add a command button called 'cmdStop'
'4. Add a command button called 'cmdPause'
5. Add a command button called 'cmdRewind'
6. Add a timer called 'Timer1'
7. Add a progress bar called 'prgWAV'
8. Paste all the code from this example to the new form's module
9. Run the form

This example assumes that the sample files are located in the
directory named by the following constant.

Private Const mcstrExamplePath = "c:\vbsbsamp"

Dim mWavMid As CWAVMID

Private Sub cmdPause_Click()
' Pause playback
mWavMid.Pause
End Sub

Private Sub cmdPlay_Click()
' Play the file
mWavMid.Play
End Sub

Private Sub cmdRewind_Click()
' Rewind the file
mWavMid.Rewind
End Sub

Private Sub cmdStop_Click()
' Stop the playback
mWavMid.StopPlay
End Sub

Private Sub Form_Load()
Set mWavMid = New CWAVMID

' set the filename
mWavMid.FileName = mcstrExamplePath & "\test.wav"
' open the file
mWavMid.OpenWAV

' Set the button captions
cmdPlay.Caption = "Play"
cmdPause.Caption = "Pause"
cmdStop.Caption = "Stop"
cmdRewind.Caption = "Rewind"

' Setup the progress meter
prgWAV.Min = 0
prgWAV.Max = mWavMid.Length

' Setup the timer
Timer1.Interval = 500

End Sub

Private Sub Form_Unload(Cancel As Integer)
Set mWavMid = Nothing
End Sub

Private Sub Timer1_Timer()
' Indicate the amount of the file played
prgWAV.value = mWavMid.Position
End Sub

                                                                          Back to top

 

Acknowledgements

I would like to thank my fellow VB programmers  here at XCept Software (Tolits, Francis and Erick) for helping me with these and for sharing their own VB tips and tricks.  -- Okay guys, time for  Chat!

 

 

 

| HOME |

 

If you have any comments, questions, suggestions or  any  problems with the content of this page, Pls.let me know

 

1