|
Hi
What you have suggested it is good.it works fine but ?
i am giving you total my problem.
I am having two structure. as you kmow.
typedef struct __Second{
char buf[10];
}SECOND,*PSECOND;
typedef struct __test{
CList<PSECOND,PSECOND>my_secondstruct;
char buf[10];
}TEST,*PTEST;
CList<PTEST ,PTEST>my_example;
i have created an object of PTEST as:
PTEST test;
Allocating an memory.
Filled this structure.
check (my_example.Isempty()){
// This is my First Node
my_example.AddHead(test);
}
In this condition i am getting problem
if i am alocating the memory of
PTEST my_example= new TEST;
them i am not able to call all the member variable of CList.
So what i have to resolve my problem
Regards and Thanks
Neeraj Kumar Jha
|
|
|
|
|
GudduRanchi wrote: PTEST my_example= new TEST;
You can't do this because my_example is a CList object. The compiler should have warned you of such.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I've created a Dialog based application that records audio(using DirectX of course) and changes the header of the audio file so that I get a file that is not playable by a regular player. Now,within my application itself,when I want to playback the said file,I decode the file to a "temp" with no extension and play it back. However I cant seem to delete the file either when I exit the application or when it finishes playing.
I believe my application isnt letting go of the file when it finishes playing it despite the fact that I set all the DirectX interfaces to NULL(I tried to delete the file manually after it finished playing and got an "Access Denied" error)
Any suggestions anybody??
Thank You
|
|
|
|
|
Try calling DeleteFile(..) in your class's destructor
Rinu Raj
|
|
|
|
|
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
|
|
|
|