questa è la mia idea usando le API
due form
frmMain
bottone > cmdApri
frmMsgBoxFinto
timer > timer1 > (con interval a 500)
CODICE FRMMAIN
codice:
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Declare Sub 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 wFlags As Long)
Private Const SND_APPLICATION = &H80 ' look for application specific association
Private Const SND_ALIAS = &H10000 ' name is a WIN.INI [sounds] entry
Private Const SND_ALIAS_ID = &H110000 ' name is a WIN.INI [sounds] entry identifier
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_FILENAME = &H20000 ' name is a file name
Private Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Private Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file
Private Const SND_NODEFAULT = &H2 ' silence not default, if sound not found
Private Const SND_NOSTOP = &H10 ' don't stop any currently playing sound
Private Const SND_NOWAIT = &H2000 ' don't wait if the driver is busy
Private Const SND_PURGE = &H40 ' purge non-static events for task
Private Const SND_RESOURCE = &H40004 ' name is a resource name or atom
Private Const SND_SYNC = &H0 ' play synchronously (default)
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Sub cmdAPRI_Click()
'suona un file
Dim pth As String
pth = "C:\documenti\mionome\miofile.wav"
'''oppure
'pth = app.path & "\miofile.wav"
'''e così suonerà un file che si chiama
'''miofile.wav e che si trova nella
'''stessa cartella dove viene avviato
'''l'exe che fai...
PlaySound pth, ByVal 0&, SND_FILENAME Or SND_ASYNC
'imposta la finestra MSGBOX come "primo piano"
SetWindowPos frmmsgboxfinta.hwnd, HWND_TOPMOST, frmmsgboxfinta.Left / 15, frmmsgboxfinta.Top / 15, frmmsgboxfinta.Width / 15, frmmsgboxfinta.Height / 15, SWP_NOACTIVATE
' e la visualizza in modale
frmmsgboxfinta.Show vbModal
End Sub
CODICE FRMMSGBOXFINTO
codice:
Private Declare Function FlashWindow Lib "user32" (ByVal hwnd As Long, ByVal bInvert As Long) As Long
Private Sub Timer1_Timer()
'fa lampeggiare la finestra
FlashWindow Me.hwnd, True
End Sub
questo funge usando le API
una suona (wave)
una mette in primo piano
una fa lampeggiare (la barra)
invece di usare le normali msgbox di windows
ne usi una tua personalizzata (frmmsgboxfinta)
dove ci metti un tasto OK, nessun tasto
oppure una label con scritto "tutto fatto!"
insomma la fai come vuoi!
semplice no?
se non riesci a farlo fungere (componendolo da questo post)
allora dammi la tua email che ti mando
il progetto già pronto...
ok?
mi sembra di avere risolto il tuo problema
in modo completo e semplice!