Public Sub exitme()
Set FSO = Nothing
Set WM = Nothing
End
End Sub
Открыть/закрыть CD-ROM
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()
Call mciSendString("CD-ROM открыт", 0&, 0&, 0&)
End Sub
Private Sub Command2_Click()
Call mciSendString("CD-ROM закрыт", 0&, 0&, 0&)
End Sub
MSDN писал: писал(а): HOWTO: How to Address Multiple CDAudio Devices in Windows NT
ID: Q137579
--------------------------------------------------------------------------------
The information in this article applies to:
Microsoft Win32 Software Development Kit (SDK), versions 3.5, 5.51, 4.0
--------------------------------------------------------------------------------
SUMMARY
To use more than one CDAudio device in Windows 3.1, you had to change the System.ini file. For more information on this process, please see the following article in the Microsoft Knowledge Base:
Q82469 Using Multiple CD-ROM Drives on One Machine
Now, in Windows NT 3.5 and Windows 95, support for multiple CDAudio devices has been added to the MCI CDAudio driver. However, the problem now becomes one of how to address a particular CDAudio device.
MORE INFORMATION
MCI solves the problem of how to control a particular CDAudio device. All you need to do is open the CDAudio device, specifying the drive letter of the CD-ROM drive to be used as the element to open. The MCI string syntax to do this is as follows:
open d: type cdaudio alias cd
In this case, the CD-ROM drive is drive D:
The following code fragment demonstrates the equivalent MCI command syntax code:
MCI_OPEN_PARMS mciOpen;
TCHAR szElementName[4];
TCHAR szAliasName[32];
DWORD dwFlags;
DWORD dwAliasCount = GetCurrentTime();
DWORD dwRet;
TCHAR chDrive;
chDrive = TEXT('D'); // Use drive D
ZeroMemory( &mciOpen, sizeof(mciOpen) );
mciOpen.lpstrDeviceType = (LPTSTR)MCI_DEVTYPE_CD_AUDIO;
wsprintf( szElementName, TEXT("%c:"), chDrive );
wsprintf( szAliasName, TEXT("CD%lu:"), dwAliasCount );
mciOpen.lpstrElementName = szElementName;
mciOpen.lpstrAlias = szAliasName;
dwFlags = MCI_OPEN_ELEMENT | MCI_OPEN_SHAREABLE | MCI_OPEN_ALIAS |
MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID | MCI_WAIT;
dwRet = mciSendCommand(0, MCI_OPEN, dwFlags, (DWORD)(LPVOID)&mciOpen);
if ( dwRet == MMSYSERR_NOERROR ) {
// The device was opened successfully
}
else {
// The device was not opened successfully
}
Additional query words: 3.50 4.00 Windows 95
Oxygen писал(а):MSDN писал: писал(а): HOWTO: How to Address Multiple CDAudio Devices in Windows NT
ID: Q137579
--------------------------------------------------------------------------------
The information in this article applies to:
Microsoft Win32 Software Development Kit (SDK), versions 3.5, 5.51, 4.0
--------------------------------------------------------------------------------
SUMMARY
To use more than one CDAudio device in Windows 3.1, you had to change the System.ini file. For more information on this process, please see the following article in the Microsoft Knowledge Base:
Q82469 Using Multiple CD-ROM Drives on One Machine
Now, in Windows NT 3.5 and Windows 95, support for multiple CDAudio devices has been added to the MCI CDAudio driver. However, the problem now becomes one of how to address a particular CDAudio device.
MORE INFORMATION
MCI solves the problem of how to control a particular CDAudio device. All you need to do is open the CDAudio device, specifying the drive letter of the CD-ROM drive to be used as the element to open. The MCI string syntax to do this is as follows:
open d: type cdaudio alias cd
In this case, the CD-ROM drive is drive D:
The following code fragment demonstrates the equivalent MCI command syntax code:
MCI_OPEN_PARMS mciOpen;
TCHAR szElementName[4];
TCHAR szAliasName[32];
DWORD dwFlags;
DWORD dwAliasCount = GetCurrentTime();
DWORD dwRet;
TCHAR chDrive;
chDrive = TEXT('D'); // Use drive D
ZeroMemory( &mciOpen, sizeof(mciOpen) );
mciOpen.lpstrDeviceType = (LPTSTR)MCI_DEVTYPE_CD_AUDIO;
wsprintf( szElementName, TEXT("%c:"), chDrive );
wsprintf( szAliasName, TEXT("CD%lu:"), dwAliasCount );
mciOpen.lpstrElementName = szElementName;
mciOpen.lpstrAlias = szAliasName;
dwFlags = MCI_OPEN_ELEMENT | MCI_OPEN_SHAREABLE | MCI_OPEN_ALIAS |
MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID | MCI_WAIT;
dwRet = mciSendCommand(0, MCI_OPEN, dwFlags, (DWORD)(LPVOID)&mciOpen);
if ( dwRet == MMSYSERR_NOERROR ) {
// The device was opened successfully
}
else {
// The device was not opened successfully
}
Additional query words: 3.50 4.00 Windows 95
Думаю, что хотя код и на С, но особых проблем с его пониманием у тебя не будет. Неужели так сложно было почитать MSDN? Там все подробно и понятно написано. (единственное, что этот код не будет работать в Win95 и WinNT3.5)
Сейчас этот форум просматривают: SemrushBot и гости: 5