Usefull code snippets for you to copy and paste into your own
programs. Note that the use of A.P.I. (Application Programmable Interface) code
may cause some trouble. If you are not confident in their use you might be wiser
to avoid them!!

To center a Form
Form1.Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
_______________________________________________________
To cause a form to 'Stay on Top'
(Uses an A.P.I. call
This goes on a Module called 'StayOnTop.bas'
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 Flags As Long) As Long
''This goes on the Form
''To allow the form to be hidden
SetWindowPos frmMain.hwnd, -1, 0, 0, 0, 0, &H3
'To make the form stay on top use
SetWindowPos frmMain.hwnd, -2, 0, 0, 0, 0, &H3
_______________________________________________________
To Play a .WAV sound file (Uses an
A.P.I. call) Code from Nick Kelly
Public Function playWAV(ByVal theWAV As String) As Long
Dim lResult As Long
lResult = fPlayWave(theWAV, 0)
End Function
' Declare API Functions:
Declare Function fPlayWave Lib "winmm" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal lpFlags As Long) As Long
sub Command1_click
playWAV (App.Path & "\pip.WAV")
end sub
_______________________________________________________
|