|
I'd try that IF i was exiting the application. But if I'm fooling around by recording and then repeatedly playing back,I'd like to be able to delete the file each time it finishes playing.
Thanks for your suggestion though.Really appreciate it
|
|
|
|
|
You are creating a temp file right ?
Close the file handle of the temp file
then try DeleteFile(..)
it will work
Rinu Raj
Rinu Raj
|
|
|
|
|
Umm, I tried that too but it doesnt work.
What I am doing is using pGraph->RenderFile(abc,NULL);
|
|
|
|
|
will you paste the code you closing the handle of hile and removing file
Rinu Raj
|
|
|
|
|
HRESULT res;<br />
IMediaControl *pMediaControl;<br />
IMediaEventEx *pEvent;<br />
if(pGraph==NULL)<br />
{<br />
CMainDlg *parent=(CMainDlg *)AfxGetApp()->GetMainWnd();<br />
HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, <br />
IID_IGraphBuilder, (void **)&pGraph);<br />
<br />
if(hr==S_OK)<br />
{<br />
pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);<br />
pGraph->QueryInterface(IID_IMediaEventEx, (void **)&pEvent);<br />
USES_CONVERSION;<br />
<br />
<br />
<br />
<br />
if(DecodeMediaHeaderWithCopy(fileName,"temp"))<br />
{<br />
res=pGraph->RenderFile(A2W("temp"), NULL);<br />
pGraph->QueryInterface(IID_IMediaSeeking,(void <br />
<br />
**)&g_pSeek);<br />
<br />
<br />
}<br />
else<br />
res=pGraph->RenderFile(A2W(fileName), NULL);<br />
<br />
if(res!=S_OK)<br />
{<br />
pMediaControl->Release ();<br />
pEvent->Release();<br />
return FALSE;<br />
}<br />
pMediaControl->Run ();<br />
pMediaControl->Release ();<br />
pEvent->Release();<br />
<br />
if(FileExists("C:\\Executable\\dxh263\\temp"))<br />
{<br />
CFile m_File;<br />
<br />
<br />
if(!m_File.Open("C:\\Executable\\dxh263\\temp",CFile::modeRead,NULL))<br />
AfxMessageBox("notexs");<br />
m_File.Close();<br />
<br />
}<br />
}<br />
else<br />
return FALSE;<br />
}<br />
return TRUE;<br />
}<br />
<br />
<br />
void CMPlayer::StopPlay ()<br />
{<br />
IMediaControl *pMediaControl;<br />
IMediaEventEx *pEvent;<br />
if(pGraph==NULL)<br />
return;<br />
else<br />
{<br />
pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);<br />
pMediaControl->Stop ();<br />
pMediaControl->Release ();<br />
pGraph->QueryInterface(IID_IMediaEventEx, (void **)&pEvent);<br />
pEvent->SetNotifyWindow ((OAHWND)NULL,WM_PLAYER_ENDOFMEDIA,NULL);<br />
pEvent->Release ();<br />
pGraph->Abort();<br />
pGraph->Release (); <br />
pGraph=NULL;<br />
pMediaControl=NULL; <br />
pEvent=NULL;<br />
<br />
}<br />
::DeleteFile("C:\\Executable\\dxh263\\temp");<br />
}<br />
|
|
|
|
|
I think the file you have opened didnot get closed so First close the file using CloseHandle or fclose.
|
|
|
|
|
about ComboBox problem
<<<<<<<dialog.h>>>>>>>>
.........
public:
CComboBox Cbx;
struct Data
{
LPCTSTR lpszName;
LPCTSTR lpszValue;
int ID;
};
<<<<<<<dialog.cpp>>>>>>>
Data d;
d.lpszName=_T("Name");
d.lpszValue=_T("Value");
d.ID=1;
Cbx.InsertString(0,d.lpszName);
Cbx.SetItemDataPtr(0,(void *)d);
how to struct data append to ComboBox Control,thank
|
|
|
|
|
rxgmoral wrote: Data d;
d.lpszName=_T("Name");
d.lpszValue=_T("Value");
d.ID=1;
Cbx.InsertString(0,d.lpszName);
Cbx.SetItemDataPtr(0,(void *)d);
you need to create d on heap.
And for obvious reasons, need to delete it after use.
-- modified at 7:59 Wednesday 27th September, 2006
|
|
|
|
|
Hi
I am using CfileDialog, but i cant get it to display pointing to the correct directory
it seems to ignore the path that i pass
im using
TCHAR szFilters[] = _T ("Log Files (*.txt)|*.txt|All files (*.*)|*.*||");
CFileDialog dlg(TRUE, _T ("txt"), _T ("*.txt"),NULL, szFilters);
CString MyPath "c:\";
if (logPath.GetLength())
dlg.GetOFN().lpstrInitialDir = MyPath;
if (dlg.DoModal()==TRUE)
{
CString result = dlg.GetPathName();
ShellExecute(NULL, "Open", _T(result), NULL, NULL, SW_SHOW);
}
can anyone help
thanks
simon
|
|
|
|
|
Try CString MyPath = "C:\\"
"There are those who confuse bad management with fate"
|
|
|
|
|
brahmma wrote: Try CString MyPath = "C:\\"
have already tried that, no joy
|
|
|
|
|
did you read my answer ?
does it provide much help ?
|
|
|
|
|
You can use from Data Member m_ofn In CFileDialog that you have access to parameters of dialogbox
|
|
|
|
|
String MyPath "c:\"; is invalid. '\' is the escape character, so if you want to print a \, you must specify '\\'
CString MyPath = "C:\\";
One last thing. if (dlg.DoModal()==TRUE) is not syntactically correct. CDialog::DoModal() doesn't return a BOOL (TRUE or FALSE). it returns the exit code specified in the dialog with the call to CDialog::EndDialog() . In general, it is the ID of the buttons pressed, so you should test your CFileDialog with either IDOK or IDCANCEL .
if (dlg.DoModal() == IDOK)
-- modified at 9:30 Wednesday 27th September, 2006
|
|
|
|
|
I think you are using OS XP or 2000, then try
dlg.GetOFN().lpstrFile = MyPath;
it will work
Rinu Raj
|
|
|
|
|
si_69 wrote: CString MyPath "c:\";
This is a syntax error.
si_69 wrote: if (logPath.GetLength())
What is logPath ?
si_69 wrote: dlg.GetOFN().lpstrInitialDir = MyPath;
Since GetOFN() does not exist with VC++ v6, I used m_ofn instead. Other than that, this code works fine. Do not use strcpy() , as you simply need to assign a pointer to an existing address.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
what is this warning?
warning LNK4089: all references to "ODBC32.dll" discarded by /OPT:REF
Bravoone
|
|
|
|
|
http://vcfaq.mvps.org/ide/7.htm
The more a man knows, the more he forgives. - Catherine the Great
|
|
|
|
|
try using
#pragma warning(disable : 4089)
if not successfull try the following
disable LNK4089 by adding /IGNORE:4089 to your linker options
Rinu Raj
|
|
|
|
|
LNK4089[^]
if you still want to keep the dependency, you can remove the warning with a #pragma warning directive
|
|
|
|
|
So how exactly does this describe LNK4089? His post plainly asked what it was, not how it could be circumvented.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
But it also explains how it comes, and then how to avoid it...
|
|
|
|
|
Hey, no fair, Tox! My reply was supposed to go to Rinu_Raj. Your reply was the only good one. I hate it when CP twists things up like that.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
lol, nevermind... i misunderstood your post
|
|
|
|
|
Here is my event handling code:
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, <br />
WPARAM wParam, LPARAM lParam)<br />
{<br />
switch(msg)<br />
{<br />
case WM_CREATE:<br />
Init();<br />
case WM_PAINT:<br />
PaintScreen();<br />
break;<br />
case WM_CLOSE :<br />
DestroyWindow(hwnd);<br />
break;<br />
case WM_KEYDOWN:<br />
if(wParam == 13){<br />
ProcessCommand();<br />
}<br />
case WM_COMMAND :<br />
if(LOWORD(wParam) == ID_COMMAND)<br />
ProcessCommand();<br />
break;<br />
case WM_DESTROY :<br />
PostQuitMessage(0);<br />
break;<br />
<br />
<br />
}<br />
<br />
return DefWindowProc(hwnd, msg, wParam, lParam);<br />
}
This only works if the main window has the focus, so how can i check which key was pressed if the editbox (ID_EDITBOX) has the focus.
Ie so that if the user presses enter i can run the proccessing needed on it.
|
|
|
|