View previous topic :: View next topic |
Author |
Message |
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Thu Jul 10, 2003 4:30 pm Post subject: Open/Close Multiple CD tray Door |
|
|
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
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 |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Jul 10, 2003 4:40 pm Post subject: |
|
|
Or you can just use the following
Code: |
%H = @MCI(Set CDAudio Door Open)
%H = @MCI(Set CDAudio Door Closed)
|
_________________ -Sheep
My pockets hurt... |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Thu Jul 10, 2003 5:48 pm Post subject: |
|
|
SnarlingSheep wrote: | Or you can just use the following
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
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 |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Jul 10, 2003 5:49 pm Post subject: |
|
|
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 |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Thu Jul 10, 2003 5:53 pm Post subject: |
|
|
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
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
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Thu Jul 10, 2003 6:30 pm Post subject: |
|
|
I've found this with the ApiViewer, but it doesn't work complete... 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 _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Jul 10, 2003 6:36 pm Post subject: |
|
|
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 |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Thu Jul 10, 2003 6:38 pm Post subject: |
|
|
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 |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Jul 10, 2003 6:40 pm Post subject: |
|
|
CLIPBOARD SET usually does that...yer fired mindpower _________________ -Sheep
My pockets hurt... |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Thu Jul 10, 2003 6:42 pm Post subject: |
|
|
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 |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Thu Jul 10, 2003 6:46 pm Post subject: |
|
|
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 _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Thu Jul 10, 2003 6:52 pm Post subject: |
|
|
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.... So if anybody can tell me what I did wrong, I know how to handle the next time... _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Jul 10, 2003 6:53 pm Post subject: |
|
|
Did you see my post above, showing what you did wrong Skit? _________________ -Sheep
My pockets hurt... |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
Back to top |
|
|
|