Click to See Complete Forum and Search --> : MCI functions (mciSendCommand etc..)


Icyculyr
April 1st, 2008, 12:10 AM
I am trying to create a program to record the screen, it's for a game I play, in which I want to record how well I do, so I can compare it each time etc...

Now I need it to work primarily on Windows XP (Home & Pro SP2) and Windows Vista (All versions)

I have been looking into the MCI Functions, like:

MCI_RECORD_PARMS mrp;
mrp.dwFrom = 0;
mrp.dwTo = 10;
mciSendCommand(MCI_ALL_DEVICES, MCI_RECORD, NULL, mrp);


This is what I have so far:

case WM_CREATE:
{
MCI_RECORD_PARMS mrp;
mrp.dwFrom = 0;
mrp.dwTo = 10;
MCIERROR mcerror = mciSendCommand(MCI_ALL_DEVICE_ID, MCI_RECORD, NULL, (DWORD)(LPMCI_RECORD_PARMS)&mrp);
MCI_SAVE_PARMS msp;
msp.lpfilename = (LPCWSTR)"C:\\Documents And Settings\\Icyculyr\\Desktop\\MYFILE.avi";
mciSendCommand(MCI_ALL_DEVICE_ID, MCI_SAVE, NULL, (DWORD)(LPMCI_SAVE_PARMS)&msp);
if (mcerror != 0)
{
MessageBox(hWnd, _T("ERROR"), NULL, NULL); //this does not run
}
}


How come it does nothing? I receive no error on either of the mciSendCommands...

Does anyone know why it does not record and save the file to my desktop?

Cheers

Edders
April 1st, 2008, 07:05 AM
You are not getting an error since you are ignoring the return value from the second mciSendCommand() function. I'd also recommend showing the actual error code in the messagebox.

Icyculyr
April 2nd, 2008, 01:06 AM
You are not getting an error since you are ignoring the return value from the second mciSendCommand() function. I'd also recommend showing the actual error code in the messagebox.

I've tested both, my example only shows the first, no error either way..

And how do I show the error code in the message box? I can't figure it out, how to store a number in a buffer..

Can you tell me how to store this in a buffer

MCIERROR mciError = mciSendCommand(MCI_ALL_DEVICES, MCI_RECORD, NULL, mrp);

"Error " & mciError

I use Visual Basic, that's what I'd do there, but I don't know how to show any type of string in a variable, any number, or any string & number..

Cheers

Edders
April 2nd, 2008, 05:57 AM
I have never tried what you are trying to accomplish, so I'm not 100% sure that it can be done this way. What I am missing is that nowhere you seem to select the device from which you are making the recording.

On the topic of printing the error - I just found a better way than printing the number, you can convert the error code to a human readable text with the mciGetErrorString() function.