Valhalla Legends Forums Archive | Visual Basic Programming | App help

AuthorMessageTime
Reaper
This is a follow-up on that one prank program I'm making, I had it to play music in background and have fullscreen picture but now, since I added coding to open and close the CD drive, it won't show the form, it will play the music but no form appears. Could someone take a look at the coding at tell me what's wrong?
[code]
Private Sub Form_Unload(Cancel As Integer)
    Cancel = 1
End Sub


Private Sub Form_Load()
SendMCIString "close all", False

If (App.PrevInstance = True) Then
    End
End If
fCDLoaded = False
If (SendMCIString("open cdaudio alias cd wait shareable", True) = False) Then
    End
End If
SendMCIString "set cd time format tmsf wait", True
DoEvents
SendMCIString "set cd door open", True
SendMCIString "set cd door closed", True
End Sub
[/code]
SendMCIString "set cd door open", True
and
SendMCIString "set cd door closes", True
is like repeated a gagillion times and to save space in here I just did it twice :P
[code]
Private Function SendMCIString(cmd As String, fShowError As Boolean) As Boolean
Static rc As Long
Static errStr As String * 200

rc = mciSendString(cmd, 0, 0, hWnd)
If (fShowError And rc <> 0) Then
    mciGetErrorString rc, errStr, Len(errStr)
    MsgBox errStr
End If
SendMCIString = (rc = 0)
End Function
[/code]
Module Coding:
[code]
Declare Function mciGetErrorString Lib "winmm.dll" Alias "mciGetErrorStringA" (ByVal dwError As Long, ByVal lpstrBuffer As String, ByVal uLength As Long) As Long
Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
[/code]
November 23, 2004, 11:42 PM
R.a.B.B.i.T
[code]If (App.PrevInstance = True) Then
    End
Else
    Form1.Show
End If[/code]
November 24, 2004, 4:47 AM

Search