Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Close/Open CD-Rom doors

[es] :: Visual Basic 6 :: Close/Open CD-Rom doors

[ Pregleda: 4964 | Odgovora: 8 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

StratOS
Slovenija

Član broj: 2234
Poruke: 988
*.dsl.siol.net



+1 Profil

icon Close/Open CD-Rom doors20.05.2002. u 07:07 - pre 237 meseci
Imam jedan mali problem.

Radi se o programskom otvaranju/zatvaranju pogona CD-RW/DVD, a fora je u tome, jer sam znam da otvorim/zatvorim samo jedna preko mciSendString API funkcije(naime oni pogon koji je tretiran kao CD-Audio CDR-pogon), a trebao bi da napravim kod za mciSendCommand, tako da bih imao mogučnost izbiranja slova CD-R pogona, kojeg želim da otvorim/zatvorim (Imam naime više CD-RW,DVD pogona).

Najbolje bi bio kod u VB ili opis API funkcije.
Pozdrav StratOS
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"As a rule, software systems do not work well until they have been used, and have failed repeatedly, in real applications."
"The one who is digging the hole for the other to fall in is allready in it."
 
Odgovor na temu

SEH

Član broj: 2215
Poruke: 94
*.net.hinet.hr



Profil

icon Re: Close/Open CD-Rom doors20.05.2002. u 21:55 - pre 237 meseci
Misim da mogu u asmu napravit nesto tako. Da strpam u DLL? Ako da, jeli VB koristiti stdcall konvenciju?
 
Odgovor na temu

Dragi Tata
Malo ispod Kanade

Član broj: 1958
Poruke: 3906
199.171.112.*



+6 Profil

icon Re: Close/Open CD-Rom doors20.05.2002. u 22:14 - pre 237 meseci
Naravno, stdcall (iliti WINAPI). Drugačije ne bi mogao da pozivaš WinAPI funkcije iz VB-a.
 
Odgovor na temu

StratOS
Slovenija

Član broj: 2234
Poruke: 988
*.dsl.siol.net



+1 Profil

icon Re: Close/Open CD-Rom doors20.05.2002. u 22:21 - pre 237 meseci
Da napiši i call-ov za taj dll, ako ti baš ide.


Recimo callovi :
CloseCDDoor(DriveLetter as string) as boolean
OpenCDDoor(DriveLetter as string) as boolean

Nije se ti treba mučiti oko ostalog u vezi sa imenom "CDRW/DVD" drive-a

A možeš i da napišeš sintaksu za mcisendcommand, ja sam zabeležio samo za standardni CD/DVD pogon, no to i sam mogu da učinim koji je definiran kao CDAudi drive (Windows default).
Gledao sam i u cdplayer.exe od win9x, no ima dosta typova i parametra te konstanti kod tog.

MCIERROR mciSendCommand(
MCIDEVICEID IDDevice,
UINT uMsg,
DWORD fdwCommand,
DWORD_PTR dwParam
);

Mislim da je največa fora po mom kod MCIDEVICEID IDDevice, ne znam zašto u VB ne radi na ostalim driveoma. A i MSDN je malo ....

MCI_OPEN_ALIAS
An alias is included in the lpstrAlias member of the structure identified by lpOpen.
MCI_OPEN_SHAREABLE
The device or file should be opened as shareable.
MCI_OPEN_TYPE
A device type name or constant is included in the lpstrDeviceType member of the structure identified by lpOpen.
MCI_OPEN_TYPE_ID
The low-order word of the lpstrDeviceType member of the structure identified by lpOpen contains a standard MCI device type identifier and the high-order word optionally contains the ordinal index for the device. Use this flag with the MCI_OPEN_TYPE flag.
The following additional flags apply to compound devices:

MCI_OPEN_ELEMENT
A filename is included in the lpstrElementName member of the structure identified by lpOpen.
MCI_OPEN_ELEMENT_ID
The lpstrElementName member of the structure identified by lpOpen is interpreted as a DWORD value and has meaning internal to the device. Use this flag with the MCI_OPEN_ELEMENT flag.
The following additional flags are used with the digitalvideo device type:

MCI_DGV_OPEN_NOSTATIC
The device should reduce the number of static (system) colors in the palette. This increases the number of colors available for rendering the video stream. This flag applies only to devices that share a palette with Windows.
MCI_DGV_OPEN_PARENT
The parent window handle is specified in the hWndParent member of the structure identified by lpOpen.
MCI_DGV_OPEN_WS
A window style is specified in the dwStyle member of the structure identified by lpOpen.
MCI_DGV_OPEN_16BIT
Indicates a preference for 16-bit MCI device support.
MCI_DGV_OPEN_32BIT
Indicates a preference for 32-bit MCI device support.
For digital-video devices, the lpOpen parameter points to an MCI_DGV_OPEN_PARMS structure.

The following additional flags are used with the overlay device type:

MCI_OVLY_OPEN_PARENT
The parent window handle is specified in the hWndParent member of the structure identified by lpOpen.
MCI_OVLY_OPEN_WS
A window style is specified in the dwStyle member of the structure identified by lpOpen. The dwStyle value specifies the style of the window that the driver will create and display if the application does not provide one. The style parameter takes an integer that defines the window style. These constants are the same as the standard window styles (such as WS_CHILD, WS_OVERLAPPEDWINDOW, or WS_POPUP).
For video-overlay devices, the lpOpen parameter points to an MCI_OVLY_OPEN_PARMS structure.

The following additional flag is used with the waveaudio device type:

MCI_WAVE_OPEN_BUFFER
A buffer length is specified in the dwBufferSeconds member of the structure identified by lpOpen.
For waveform-audio devices, the lpOpen parameter points to an MCI_WAVE_OPEN_PARMS structure. The MCIWAVE driver requires an asynchronous waveform-audio device.



Hvala unaprijed!

Pozdrav StratOS
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"As a rule, software systems do not work well until they have been used, and have failed repeatedly, in real applications."
"The one who is digging the hole for the other to fall in is allready in it."
 
Odgovor na temu

SEH

Član broj: 2215
Poruke: 94
*.net.hinet.hr



Profil

icon Re: Close/Open CD-Rom doors20.05.2002. u 23:43 - pre 237 meseci
Citat:
Dragi Tata:
Naravno, stdcall (iliti WINAPI). Drugačije ne bi mogao da pozivaš WinAPI funkcije iz VB-a.


dunno, ne koristim VB :) Bas bi bilo fora da ima inline asm :)
 
Odgovor na temu

StratOS
Slovenija

Član broj: 2234
Poruke: 988
*.dsl.siol.net



+1 Profil

icon Re: Close/Open CD-Rom doors21.05.2002. u 15:01 - pre 237 meseci
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
Public Function openCD(ByVal dRv As String) As Long
Dim Alias As String
Dim retval As Long
Alias = "Drive" & dRv
retval = -1           'we need to set retval to anything other then 0
retval = mciSendString("open " & dRv & ": type cdaudio alias " & Alias & " wait", vbNullString, 0&, 0&)
retval = mciSendString("set " & Alias & " door open", vbNullString, 0&, 0&)
openCD = retval
End Function
Public Function closeCD(ByVal dRv As String) As Long
Dim Alias As String
Dim retval As Long
Alias = "Drive" & dRv
retval = -1           'we need to set retval to anything other then 0
 retval = mciSendString("set " & Alias & " door closed", vbNullString, 0&, 0&)
 retval = mciSendString("close " & Alias, vbNullString, 0&, 0&)
closeCD = retval
End Function

Hvala SEH
Pozdrav StratOS
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"As a rule, software systems do not work well until they have been used, and have failed repeatedly, in real applications."
"The one who is digging the hole for the other to fall in is allready in it."
 
Odgovor na temu

jc denton

Član broj: 2358
Poruke: 1705
*.ptt.yu



Profil

icon Re: Close/Open CD-Rom doors21.05.2002. u 15:12 - pre 237 meseci
StratOS : Samo da znas da sam morao da stavim dva cd roma u racunar zbog ove problematike... , mada interesantan problem

Ja sam uradio ovako, mada je slicno kao kod tebe :

temp = mciSendString("open e:\ type CDAudio alias cd1", "", 0, 0)
temp = mciSendString("open f:\ type CDAudio alias cd2", "", 0, 0)

temp = mciSendString("Set cd1 Door Open", "", 0, 0)
temp = mciSendString("Set cd2 Door Open", "", 0, 0)

Prepravi e:\ i f:\ na odgovarajuca slova za cd romove koji su kod tebe u racunaru. i to je to.

Pozdrav

fire, walk with me
 
Odgovor na temu

zeljo

Član broj: 2965
Poruke: 143
195.252.78.*



Profil

icon Re: Close/Open CD-Rom doors21.06.2002. u 01:42 - pre 236 meseci
ako imas kod za jedan CD kao to da uradis pa nevidim u cei je problem samo moras da poveses i ostale primjer:

Postavis Command1 u njega upises kod koji imas neka ti to bude z disk E:
u kodu ces da naglasis da je komadna za disk E:/

Potom postavis Command2 isti kod sve isto samo ovaj put stavljas disk F:/ vezes komandu za njega i tako redom

Na svako komandno dugme na Formi moras u Capation da postavis ime sa koji disk je komanda da bi znao prilikom rada...

Nadam se da je to to koliko sam svatio, necu ti pisati kod posto kazes da ga imas...
 
Odgovor na temu

StratOS
Slovenija

Član broj: 2234
Poruke: 988
*.dsl.siol.net



+1 Profil

icon Re: Close/Open CD-Rom doors21.06.2002. u 06:14 - pre 236 meseci
Baš ti hvala na tako izcrpnom izvešču ....
Citat:

Postavis Command1 u njega upises kod koji imas neka ti to bude z disk E:
u kodu ces da naglasis da je komadna za disk E:/


A kod za VB napisan u prijašnjim postovima.
pozdrav !
Pozdrav StratOS
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"As a rule, software systems do not work well until they have been used, and have failed repeatedly, in real applications."
"The one who is digging the hole for the other to fall in is allready in it."
 
Odgovor na temu

[es] :: Visual Basic 6 :: Close/Open CD-Rom doors

[ Pregleda: 4964 | Odgovora: 8 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.