forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Open/Close Multiple CD tray Door
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced VDS 5 Source Code
View previous topic :: View next topic  
Author Message
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Thu Jul 10, 2003 4:30 pm    Post subject: Open/Close Multiple CD tray Door Reply with quote

Open/Close CD tray Door :
Get tthe latest version here below from the link(this script is obsolete)

EDIT:
http://www.vdsworld.com/index.php?page=download&fileid=302

This small script helps to open/close your CD tray.
Useful for player applications.
It opens/closes the default CD drive.

USE AT YOUR OWN RISK !!
MISTAKES MADE WHILE USING A NON VDS DLL MAY INVITE A VDS/SYSTEM CRASH.
SAVE YOUR WORK BEFORE RUNNING/DEBUGGING THIS SCRIPT.
Code:

#-----------------------------------------------------------------------------#
#-Calling a Non-VDS dll Open/Close CD tray Door by CodeScript-----------------#
#-Author: CodeScript----------------------------------------------------------#
#-Copyright: You can remove this info while Using this code in your app.------#
#------------but may be kind enough to add a word to your documentation-------#
REM USE AT YOUR OWN RISK !!
REM MISTAKES MADE WHILE USING A NON VDS DLL MAY INVITE A VDS/SYSTEM CRASH.
REM SAVE YOUR WORK BEFORE RUNNING/DEBUGGING THIS SCRIPT.
  Title Open/Close CD tray Door by CodeScript
  DIALOG CREATE,Open/Close CD tray Door by CodeScript,-1,0,374,129,CLASS MYWIN
  DIALOG ADD,BUTTON,BUTTON1,48,66,96,38,Open Cd Door
  DIALOG ADD,BUTTON,BUTTON2,50,220,90,36,Close Cd Door
  DIALOG SHOW
 

 :Evloop
  wait event
  goto @event()
 
:BUTTON1BUTTON
LOADLIB WINMM
 %I = @lib(winmm,mciSendStringA,STR:,Set CDAudio Door Open,0,0,0)
Freelib WINMM
goto EVLOOP

:BUTTON2BUTTON
LOADLIB WINMM
 %I = @lib(winmm,mciSendStringA,STR:,Set CDAudio Door Closed,0,0,0)
Freelib WINMM
goto EVLOOP

:close
exit


___________________________________________________________________

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension


Last edited by CodeScript on Thu Jul 31, 2003 6:28 pm; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Jul 10, 2003 4:40 pm    Post subject: Reply with quote

Or you can just use the following Wink
Code:

%H = @MCI(Set CDAudio Door Open)
%H = @MCI(Set CDAudio Door Closed)

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Thu Jul 10, 2003 4:53 pm    Post subject: Reply with quote

I still don't know how to use all that API stuff... CodeScript, maybe you can explain where you've found it, and how you converted it into VDS code? Thanks. Smile
_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Thu Jul 10, 2003 5:48 pm    Post subject: Reply with quote

SnarlingSheep wrote:
Or you can just use the following Wink
Code:

%H = @MCI(Set CDAudio Door Open)
%H = @MCI(Set CDAudio Door Closed)


Yes I could have done that - but simply didnt want to introduce another varable when it is not needed- increased confusion to one who views it - Am i wrong there ?

Skit 3000
I got the idea from a vb code found on a forum - from google cache - lying on my HD for months -may be more. I will post the corresponding VB code :

Code:


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 Command1_Click()
  Dim Dummy As String
  Dummy = vbmciSendString("set cdaudio door open", 0)
End Sub

Private Sub Command2_Click()
  Dim Dummy As String
  Dummy = vbmciSendString("set cdaudio door closed ", 0)
End Sub

Function vbmciSendString(ByVal Command As String, ByVal hWnd As Long) As String
    Dim Buffer As String
    Dim dwRet As Long
    Buffer = Space$(100) ' Create a buffer
    dwRet = mciSendString(Command, ByVal Buffer, Len(Buffer), hWnd)
    vbmciSendString = Buffer
End Function


_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension


Last edited by CodeScript on Thu Jul 10, 2003 5:50 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Jul 10, 2003 5:49 pm    Post subject: Reply with quote

CodeScript:
I was saying that VDS already has a built in MCI command and function.

Skit:
MSDN is hard to navigate for some people but still a good place to find information on API functions.
APIViewer is a good program.

_________________
-Sheep
My pockets hurt...


Last edited by SnarlingSheep on Thu Jul 10, 2003 5:54 pm; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Thu Jul 10, 2003 5:53 pm    Post subject: Reply with quote

OK I think I have to read the help file more.
AS u siad that when U can do it with vds - no need for calling the winmm.dll directly. BTW I am Sleep

SKit
If U want to have a standard reference W32.HLP file I think aroung 9 mb or so. But U get good idea as to what a function does.
API viwer is good too and can help U find some latest ones not in the W32.HLP file. and also constants if U dont have VB - API text viewer.

I am also just a starter with APIs

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Thu Jul 10, 2003 6:30 pm    Post subject: Reply with quote

I've found this with the ApiViewer, but it doesn't work complete... Crying or Very sad Can you tell me what I did wrong?

I got some info here too.

Code:
clipboard set,Just some text...

loadlib user32

rem Following line comes out of the ApiViewer
rem Private Declare Function EmptyClipboard Lib "user32.dll" () As Long
%i = @lib(user32,EmptyClipboard,INT:)

  list create,1
  list paste,1
  info |%i|@text(1)|
  list close,1

freelib user32

exit


Btw. I found out that if I don't use the INT: parameter, %i returns nothing...


Thanks Smile

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Jul 10, 2003 6:36 pm    Post subject: Reply with quote

Quote:
Before calling EmptyClipboard, an application must open the clipboard by using the OpenClipboard function. If the application specifies a NULL window handle when opening the clipboard, EmptyClipboard succeeds but sets the clipboard owner to NULL. Note that this causes SetClipboardData to fail.

Info on EmptyClipboard at MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/dataexchange/clipboard/clipboardreference/clipboardfunctions/emptyclipboard.asp
Code:

clipboard set,Just some text...

loadlib user32
%i = @lib(user32,OpenClipboard,INT:,0)
%i = @lib(user32,EmptyClipboard,INT:,0)
%i = @lib(user32,CloseClipboard,INT:,0)

  list create,1
  list paste,1
  info |%i|@text(1)|
  list close,1

freelib user32

exit

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Thu Jul 10, 2003 6:38 pm    Post subject: Reply with quote

Um Skit,
Are you putting anything on the clipboard first? Also why are you guys trying to do things the hard way? VDS already has the ability to clear the clipboard.

CLIPBOARD CLEAR

_________________
Home of

Give VDS a new purpose!


Last edited by vdsalchemist on Thu Jul 10, 2003 6:41 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Jul 10, 2003 6:40 pm    Post subject: Reply with quote

CLIPBOARD SET usually does that...yer fired mindpower Wink
_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Thu Jul 10, 2003 6:42 pm    Post subject: Reply with quote

You can't fire me...I quit! Also I want my last pay check! Oh wait I never got a pay check...
_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Thu Jul 10, 2003 6:46 pm    Post subject: Reply with quote

CodeScript wrote:
If U want to have a standard reference W32.HLP file I think aroung 9 mb or so.


For everyone here there is a link to this file already in the Articles section of vdsworld.com. It has been there since I first posted my Gadget.dll last year Wink

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Thu Jul 10, 2003 6:52 pm    Post subject: Reply with quote

Quote:
Um Skit,
Are you putting anything on the clipboard first? Also why are you guys trying to do things the hard way? VDS already has the ability to clear the clipboard.

CLIPBOARD CLEAR


I just want to learn something, and thought this would be an easy way.... Rolling Eyes So if anybody can tell me what I did wrong, I know how to handle the next time... Wink

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Jul 10, 2003 6:53 pm    Post subject: Reply with quote

Did you see my post above, showing what you did wrong Skit?
_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Thu Jul 10, 2003 7:01 pm    Post subject: Reply with quote

Oops.... Embarassed I'm sorry I haven't seen it.. Crying or Very sad

Thanks for posting.. Now I know what I forgot... Smile

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced VDS 5 Source Code All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group