• Welcome to Valhalla Legends Archive.
 

App help

Started by Reaper~, November 23, 2004, 05:42 PM

Previous topic - Next topic

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?

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

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

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

Module Coding:

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
Take my advice, I'm not using it.

R.a.B.B.i.T

If (App.PrevInstance = True) Then
    End
Else
    Form1.Show
End If