|
-
May 20th, 1999, 10:38 AM
#1
PreTranslateMessage
Hi,
I´m having some trouble getting the preTranslateMessage funktion to work while playing a movie using Dshow.
this is what I call, but it wont react at all. My guess is because it has rendered the file and doesn´t let any other messages pass throug. But how do I solve this. I want to be able to close the playing window with the esc-button.
this is my preTranslateMessage function.
if (pMsg->message == WM_KEYDOWN)
if (pMsg->wParam == VK_ESCAPE)
PostMessage(WM_CLOSE);
please help
Regards Frederik.
-
May 22nd, 1999, 08:20 AM
#2
Re: PreTranslateMessage
HOw did you start playing ....
Sally
-
May 22nd, 1999, 09:32 AM
#3
Re: PreTranslateMessage
I start playing via a button in my maindlg. The command that´s done when pressing this button is:
void CDshowDlg::Play()
{
if( CanPlay() )
{
HRESULT hr;
hr = pigb->QueryInterface(IID_IMediaControl, (void **) &pimc);
if( SUCCEEDED(hr) )
{
#undef REWIND
#define FROM_START
#ifdef REWIND
hr = pigb->QueryInterface(IID_IMediaPosition, (void**) &pimb);
if (SUCCEEDED(hr))
{
// start from last position, but rewind if near the
// end
REFTIME tCurrent, tLength;
hr = pimp->get_Duration(&tLength);
if (SUCCEEDED(hr))
{
hr = pimp->get_CurrentPosition(&tCurrent);
if (SUCCEEDED(hr))
{
// within 1sec of end? (or past end?)
if ((tLength - tCurrent) < 1)
pimp->put_CurrentPosition(0);
}
}
pimp->Release();
}
#endif
hr = pimc->Run();
pimc->Release();
if( SUCCEEDED(hr) )
{
m_State=Playing;
return;
}
}
// Inform the user that an error occurred
TCHAR msg;
AMGetErrorText(hr, &msg,NULL);
AfxMessageBox(msg);
}
}
Also before this I call a loadfile funcition, which renders the file.
BOOL CDshowDlg::LoadFile(LPSTR lpszPathName)
{
ObjectRelease();
if ( !CreateFilterGraph() )
return FALSE;
MultiByteToWideChar( CP_ACP, 0, lpszPathName,-1, wFile, MAX_PATH );
HRESULT hr = pigb->RenderFile(wFile, NULL);
if (FAILED(hr))
{
TCHAR msg;
AMGetErrorText(hr, &msg,NULL);
AfxMessageBox(msg);
return FALSE;
}
m_State = Stopped;
return TRUE;
}
Any ideas?
-
May 23rd, 1999, 03:34 AM
#4
Re: PreTranslateMessage
Maybe, just maybe, the playing does not release clock cycles to Windows, so no messages are processed....
Sally
-
May 23rd, 1999, 08:23 AM
#5
Re: PreTranslateMessage
Yeah, that sounds like the case here. I can always use the alt+F4 to shut it down, but I really wanna use the esc-button to do this. Any Idea how i can do this in another way?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|