PDA

Click to See Complete Forum and Search --> : DAMN MICROSOFT!!!!! (winmm.dll)


nukem996
Feb 15th, 2001, 03:11 PM
ok looking threw the msdn library. i find nothing on winmm.dll api in vb. for every thing and i find asll this really kick @$$ c++ things. i cannt find any advanced stuff on the sites. so here i am. i need to know how to do a few things.

1. how to program Const in api

2. how to do all those c++ things in vb, one of the things i want to do is get all this info about a mp3 so i looked it up and its c++. i put this code in
MsgBox (i = mciSendString("info %s %s %s", 0&, product, 0&)), vbCritical
to c c++ code then go into msdn library and look this up cdaudio info. huge table thier.

3. why this code dosent work to play a cd on my computer.
Dim i as Long
i = mciSendString("open type CDaudio", 0&, 0&, 0&)
i = mciSendString("play CDaudio from 0", 0&, 0&, 0&)

Feb 16th, 2001, 03:22 PM
I think you should try a bit more Basic VB for now... From the hearing of you I can tell you don't understand the basics yet (or do not understand programming at all)...

But to answer your questions:

1) CONST is a CONSTANT.
Try this:


CONST Five = 5

MsgBox Five + Five


2)C++ is just another language, but works a bit different too:


vb
Dim TheNumber as integer

TheNumber=100
Print "Hello. The number is " & TheNumber

C(++)
int TheNumber;

TheNumber=100;
printf("Hello. The Number is: %d\n", TheNumber);


But the general idea is the same...

3)You're trying to make an API call. You'll have to declare it first:


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 DoSomething()
Dim i as Long
i = mciSendString("open type CDaudio", 0&, 0&, 0&)
i = mciSendString("play CDaudio from 0", 0&, 0&, 0&)
End Sub


That's it....

nukem996
Feb 16th, 2001, 03:38 PM
I see what I did wrong. I didn't open cdaudio, didn't think you needed to do that. I thought the play command did. But what if your getting const from a API call. Like
Private Const MCI_SEEK_TO_END = &H200&
how would you use that?

nukem996
Feb 16th, 2001, 03:38 PM
thx for the help!!! :D :D :D :D :D :D :D

Feb 16th, 2001, 03:57 PM
MSDN says:


The MCI_SEEK command changes the current position in the content as quickly as possible. Video and audio output are disabled during the seek. After the seek is complete, the device is stopped. CD audio, digital-video, MIDI sequencer, VCR, videodisc, and waveform-audio devices recognize this command.

To send this command, call the mciSendCommand function with the following parameters.

MCIERROR mciSendCommand(
MCIDEVICEID wDeviceID,
MCI_SEEK,
DWORD dwFlags,
(DWORD) (LPMCI_SEEK_PARMS) lpSeek
);


So this'll be something like this:


Private Declare Function mciSendCommand Lib "winmm.dll" Alias "mciSendCommandA" (ByVal wDeviceID As Long, ByVal uMessage As Long, ByVal dwParam1 As Long, ByVal dwParam2 As Any) As Long
Private Const MCI_SEEK_TO_END = &H200&


And somewhere in your code:


mciSendCommand 0&, MCI_SEEK_TO_END, 0&, 0&


(The one thing I don't know (and don't want to investigate) is if you really need a deviceID (=first parameter) or if it's ok to pass NULL (=0&) for the "current device"/"cd audio")