Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 1st, 2006, 1:20 PM   #1
john Wesley
Hobbyist Programmer
 
john Wesley's Avatar
 
Join Date: May 2006
Location: United Kingdom
Posts: 119
Rep Power: 3 john Wesley is on a distinguished road
Send a message via MSN to john Wesley Send a message via Yahoo to john Wesley
app has heavy payload on exit

im creating a program that simply controls your cd-rom drive, opens/closes/runs it etc...if anyone can though i would highly appreciate to know why a peice of code ( below ) likes to hang or engages in the 'error report' procedure when you exit the form, or it can sometimes happen when the 'Open' button is pressed a couple of times without a gap/giving the drawer time to fully open or close. information granted to me on this matter would be a real relief and appreciated considerably.
Thanks for you time.

Private 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

Private Sub cmdOpen_Click()
Dim lngReturn As Long
Dim strReturn As Long

lngReturn = mciSendString("set CDAudio door open", strReturn, 127, 0)

End Sub

Private Sub cmdClose_Click()
Dim lngReturn As Long
Dim strReturn As Long

lngReturn = mciSendString("set CDAudio door closed", strReturn, 127, 0)

End Sub
__________________
Mona Lisa must of had the highway blues you can tell by the way she smiles..
john Wesley is offline   Reply With Quote
Old Jun 1st, 2006, 2:23 PM   #2
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Yeah, I recall this problem for windows XP. Don't know about 2000 and up, but I know it worked for windows 98. When I moved it to XP, I get the same error. I've googled it, but can't find an answer. Anyone else know? I would sure like to know
Booooze is offline   Reply With Quote
Old Jun 1st, 2006, 2:46 PM   #3
john Wesley
Hobbyist Programmer
 
john Wesley's Avatar
 
Join Date: May 2006
Location: United Kingdom
Posts: 119
Rep Power: 3 john Wesley is on a distinguished road
Send a message via MSN to john Wesley Send a message via Yahoo to john Wesley
for me this problem persists on ME also. havnt tried any others than XP and ME though.
__________________
Mona Lisa must of had the highway blues you can tell by the way she smiles..
john Wesley is offline   Reply With Quote
Old Jun 1st, 2006, 5:12 PM   #4
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
So I decided to look into this, and so I tested your code, and it worked, no problem for me...lol. I've looked it up on google, and have come to the idea that this may not be OS related. It might come down to hardware. Perhaps consider finding a different variation of the code? Although, for the most part, it all seems to be the same. I'm not sure what to think of this one. Maybe one of the more experienced members will have the answer.

[EDIT] Perhaps it doesn't work, my VS 2005 debugger is kicking in.
Booooze is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:22 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC