|
Hi Dear,
I am trying to index metadata for doc file for indexing purpose using IFilter implementation.
I have the OffFilter.dll which implements IFilter for office documents like .doc etc.
I am able to load the filter but the problem is it is only retrieving the contents of the file. I want other data like size of the file etc which it is not returning.
Below is the code snippet
===============================
CComQIPtr<ifilter> pFilterText;
//Initialize the COM LIB
if ( FAILED( ::CoInitialize( NULL ) ) )
return ;
HRESULT hr;
CLSID clsId;
IFilter * pFilter;
WCHAR * cPath = _T("D:\\Projects\\NBS\\Development items for Oasys post release 1.0.0.46 (RasterX issues).doc");
hr = ::LoadIFilter(cPath, NULL, (void**)&pFilter ); //LoadIFilter uses a means such as CoCreateInstance() to create the filter and then calls IPersistFile::Load with the name of the specified file.
if ( FAILED( hr ) )
{
return ;
}
CComQIPtr<ipersistfile> pPersistFile( pFilter );
SCODE ret = 0;
FULLPROPSPEC *fullPropSpec1, *fullPropSpec2;
fullPropSpec1 = new FULLPROPSPEC;
fullPropSpec2 = new FULLPROPSPEC;
GUID guidPropSet = PSGUID_STORAGE;
fullPropSpec1->guidPropSet = guidPropSet;
fullPropSpec1->psProperty.ulKind = PRSPEC_PROPID;
fullPropSpec1->psProperty.propid = PID_STG_CONTENTS ;
fullPropSpec2->guidPropSet = guidPropSet;
fullPropSpec2->psProperty.ulKind = PRSPEC_PROPID;
fullPropSpec2->psProperty.propid = PID_STG_SIZE;
FULLPROPSPEC* pArrFPS [] = {fullPropSpec1, fullPropSpec2};
ULONG flags = 0;
ULONG grFlags = IFILTER_INIT_CANON_PARAGRAPHS |
IFILTER_INIT_APPLY_INDEX_ATTRIBUTES |
IFILTER_INIT_HARD_LINE_BREAKS |
IFILTER_INIT_CANON_HYPHENS |
IFILTER_INIT_CANON_SPACES;
sizeof(FULLPROPSPEC);
ret = pFilter->Init(grFlags ,2 , *pArrFPS, &flags );
ATLASSERT( SUCCEEDED( ret ) );
STAT_CHUNK statChunk;
WCHAR szText[1024] =_T("");
ULONG lLength = 1024;
ret = 0;
CString str;
bool bDone = false;
while(1)
{
size_t s = sizeof(grFlags);
ret = pFilter->GetChunk( &statChunk );
if(statChunk.attribute.psProperty.propid == 12)
AfxMessageBox("Size retrived");
if(statChunk.attribute.psProperty.propid == 19)
AfxMessageBox("Content retrived");
}
I doubt I am passing wrong attributes to thr IFilter::Init() function.
Can anybody please help me?
Let me know if you need more info and a sample project also.
Javed A Ansari
Software Developer
Hyderabad, India
|
|
|
|
|
I am working a porject which is using CORBA with C++, , Iona Orbix 3.3 now planning to migrated to Orbix 6.1 or 6.2,
Can any of you have the idea, how it should be done, ie the steps to proced with
And the the best version of orbix to go for ie., 6.1 or 6.2...
pls advice
|
|
|
|
|
Hello and good day. I have this one big dialog with different objects (buttons, listboxes, picturebox, static text, etc.) in it. All of these have a common process that should be called first when the user left clicks the mouse over the object. I have checked the OnLButtonDown method but it seems that it is not called when the user clicks over a component (for a button, it processes the OnClick
method and doesn't process the OnLButtonDown). Now, the reason I want to do this is because I don't want to add an OnClick for every component I have then place the same codes over again; but instead just check a coordinates table and see if the user clicked over an object. Is this possible with OnLButtonDown or would there be any other functions I can use to achieve what I am trying to do?
Thank you for the time and help.
|
|
|
|
|
Llasus wrote: Now, the reason I want to do this is because I don't want to add an OnClick for every component I have then place the same codes over again;
Actually you have only to call the same piece of code, in each event handler. I think it is not a big overhead. Why do you want to go against Windows event handling mechanism?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: Actually you have only to call the same piece of code, in each event handler. I think it is not a big overhead. Why do you want to go against Windows event handling mechanism?
The problem is, there are tons of objects in there, and I think by adding one OnClick for each objects will cause the code to be longer than what it should be. Like adding OnClick for each textbox and there are 20 of them and all of those 20 contains just one call of a function. 
|
|
|
|
|
Actually MFC allows to map messages of multiple controls to a single handler, provided their ID s are contiguous, see for instance
[^]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks! I have only seen this one just now though, I'll stick with PreTranslateMessage for now since its the best solution for my problem for now. Thank you for your help and time!
|
|
|
|
|
Llasus wrote: ...cause the code to be longer than what it should be.
You can't seriously think this is a problem, can you? See here for more.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: You can't seriously think this is a problem, can you?
When you've got firmware programmers as your leaders, yes its a problem 
|
|
|
|
|
Llasus wrote: would there be any other functions I can use to achieve what I am trying to do?
overide the PreTranslateMessage function in the dialog class and check for the WM_LBUTTONDOWN message.
BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)<br />
{<br />
if( pMsg->message == WM_LBUTTONDOWN )<br />
{<br />
if( pMsg->hwnd != m_hWnd )
{<br />
}<br />
}<br />
return CDialog::PreTranslateMessage( pMsg );<br />
}
|
|
|
|
|
Naveen wrote: overide the PreTranslateMessage function in the dialog class and check for the WM_LBUTTONDOWN message.
Thank you! Just what I was looking for Thank you very much!
|
|
|
|
|
What about WM_MOUSEACTIVATE?
Sincerely,
Spy++
|
|
|
|
|
Within the WM_MOUSEACTIVATE handler, I guess you could call
GetDlgCtrlID(GetFocus()) to get the identity of the control.
|
|
|
|
|
//In DlgProc:
if ((msg == WM_MOUSEACTIVATE) &&
(HIWORD(lParam) == WM_LBUTTONDOWN)) {
POINT pt;
GetCursorPos(&pt);
int ctrlID = GetDlgCtrlID(WindowFromPoint(pt)));
}
|
|
|
|
|
You can write your answers at one message. 
|
|
|
|
|
Thanks for the help and sorry for the late reply (different timezone) At what event handler should I place this code? I checked OnMouseActivate but lParam and msg is not there.
|
|
|
|
|
How to check the admin/user previleges in Vista and XP
|
|
|
|
|
|
See IsUserAnAdmin()[^] method.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I want check if a certain file is present at a certain location.
I am using the FileCreate function for this, but I have a problem in the creation of the filename parameter.
if I use the next line to create the filename everything works fine if the specified file is in the same directory as the source:
sprintf(FileName,"%s.txt",ProdBest[i]); //ProdBest is an array of strings containing the filename.
But I want a clear seperation between my Production files and the programm files, and store the Production files in a seperate directory (C:\ProdIn)
If I use the following line I always end up getting a INVALID_HANDLE_VALUE with GetLastError code = 2 (FILE_NOT_FOUND).
sprintf(FileName,"C:\ProdIn\%s.txt",ProdBest[i]);
So clearly I am making a mistake, but I don't know where or what
Can someone help me out?
|
|
|
|
|
Try using double back slash instead of single like this.
sprintf(FileName,"C:\\ProdIn\\%s.txt",ProdBest[i]);
|
|
|
|
|
|
You can use of FindFirstFile for see file exist or no.
|
|
|
|
|
I want to allow user for open my application only 1 time in one PC.
for avoid resource duplication problem.
How can I do?
|
|
|
|
|
If you are using MFC, take a look at this article[^].
BTW, searching before asking the qestion sometimes brings a lot of usefull results. There are plenty of nice articles on codeproject about a very broad range of subjects.
|
|
|
|