|
Dear All,
I have a compound file (IStorage) structure. This file has a sub storage that will contain MSWord,Excel files. My question is how to edit/open the MSWord files directly from the compound file. I tried to use Document IPersistStorage interface.
But I don't know how to pass/add it to Documents ( Collection ).
So It seems that the document was loaded but never showed up.
Does anybody have done this before ?
Thank's
|
|
|
|
|
hi all . could any one help me fix this compilation error. I am using visual studio 6.Thanks
error :
-------------------Configuration: FindUser - Win32 Debug--------------------<br />
Compiling...<br />
FindUser.cpp<br />
FindUserDlg.cpp<br />
C:\visualC\FindUser\FindUserDlg.cpp(15) : error C2653: 'FindUserDlg' : is not a class or namespace name<br />
Generating Code...<br />
Error executing cl.exe.<br />
<br />
FindUser.exe - 1 error(s), 0 warning(s)
pointing at :
int FindUserDlg::GetPosByNick(CString szNick) {
in FindUserDlg.cpp : implementation file
error pic:
[img]http://i5.photobucket.com/albums/y180/method007/error3.jpg[/img]
finduserdlg.h content
<br />
<br />
#if !defined(AFX_FINDUSERDLG_H__8EF5BE4C_79B2_4F61_B376_E2A019C98B9C__INCLUDED_)<br />
#define AFX_FINDUSERDLG_H__8EF5BE4C_79B2_4F61_B376_E2A019C98B9C__INCLUDED_<br />
<br />
#if _MSC_VER > 1000<br />
#pragma once<br />
#endif // _MSC_VER > 1000<br />
<br />
<br />
<br />
<br />
<br />
class CFindUserDlg : public CDialog<br />
{<br />
public:<br />
CFindUserDlg(CWnd* pParent = NULL);
<br />
enum { IDD = IDD_FINDUSER_DIALOG };<br />
<br />
protected:<br />
virtual void DoDataExchange(CDataExchange* pDX);
<br />
protected:<br />
HICON m_hIcon;<br />
<br />
virtual BOOL OnInitDialog();<br />
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);<br />
afx_msg void OnPaint();<br />
afx_msg HCURSOR OnQueryDragIcon();<br />
afx_msg void OnButton1();<br />
DECLARE_MESSAGE_MAP()<br />
<br />
public: <br />
int GetPosByNick(CString szNick); ======== placed it here<br />
<br />
};<br />
<br />
<br />
#endif // !defined(AFX_FINDUSERDLG_H__8EF5BE4C_79B2_4F61_B376_E2A019C98B9C__INCLUDED_)
-- modified at 16:31 Monday 10th July, 2006
|
|
|
|
|
You should use the DECLARE_MESSAGE_MAP() macro at the end of your class declaration; no more declaration/defintion after it.
Best,
Jun
|
|
|
|
|
I may be wrong, but shouldn't the implementation be :
<br />
int CFindUserDlg::GetPosByNick(CString szNick)<br />
{<br />
..<br />
} ?,
Not
int FindUserDlg::GetPosByNick(CString szNick)..
As shown in your pic.
I Dream of Absolute Zero
|
|
|
|
|
I realise this is a very advanced question!
I have a server application which I'm trying to add performance counters to, to allow the server's performance to be monitored using standard tools, such as the System Monitor ActiveX control (most users will know this as part of the Performance management console in Administrative Tools). There's a reasonable amount of documentation on actually creating your performance counters, and I'm using a chunk of code that came with my copy of 'Programming Server-Side Applications for Windows' by Jeff Richter and Jason Clark. I've already got a number of simple counters (those using PERF_COUNTER_COUNTER and PERF_COUNTER_RAWCOUNT) running.
My problem is that I've got a piece of data I want to expose and no idea how to define this counter. I'd like to be able to show the average percentage utilisation of a set of worker objects, defined as the average amount of time they were used in the sample period. The value shown should be ((current sample - last sample) / (number of objects)) / (current sample time - last sample time). Doing this allows me to simply add the duration of an operation to the counter. It doesn't look like this is possible, though, certainly with the standard counter types.
The actual server is written in VB6 so I'd like to avoid 64-bit counters and timers if at all possible! I'm writing the performance counter values using a C++ DLL which the VB6 code calls into.
I can divide the time elapsed by the number of objects myself, but this obviously loses accuracy, since it's an integer division.
Any ideas greatly appreciated.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Have you tried breaking the calculation up into seperate lines of code and using casts to correct the data types between each operation.
Darka [Xanya]
|
|
|
|
|
Well, in case anyone else finds this:
My solution is to use a counter of type PERF_100NSEC_TIMER, which is the type used by, for example, the Processor\% Idle Time counter. I'm still supplying the time in milliseconds but have extended my DLL to multiply up the value I pass in by 10000, to convert from 1ms to 100ns intervals. I'm dividing the value I pass by the number of objects, which leads to a degree of inaccuracy for objects used very infrequently but with a long execution time (showing 300% at one point using a 1s sample period) but since I'm more interested in the long-term average, this is acceptable.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Wat do you mean by its not working you can put a break point and see through which control path the flow is going .
Regards,
FarPointer
Blog:FARPOINTER
|
|
|
|
|
thanks for your help it is now working.
how can i move items up and dowm in the list.
i am a beginner
|
|
|
|
|
Hello
I have designed a program that takes in a list of structs of type data (shown below). The program works fine. But I need a way of sorting the list by decreasing length of string Sequence. In other words, I need to determine the length of each Sequence and position each data so that the longest strings appear first.
So I am not comparing strings themselves, but lengths of strings. I know there is a sort function that is part of the <list> class, but I am not sure if I can use it in this situation.
Thanks in advance for anyone who can come to a solution.
HRW.
#include <string>
#include <list>
#include <iostream>
#include <fstream>
using namespace std;
struct data
{
string Length;
string Sequence;
string N_Terminal;
string C_Terminal;
};
list<data> g_DataList;
list<data>::iterator dataListIter;
-- modified at 11:29 Monday 10th July, 2006
|
|
|
|
|
Isn't the third parameter of sort() a (pointer to a) comparison routine?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Assuming that the length of Sequence is stored in Length, you can provide your own comparison function, which compares Length data between any two list items.
Best,
Jun
|
|
|
|
|
|
This program for the first link is not compiling and it is hard to see where the sort is taking place. I will check the other link.
-- modified at 13:04 Monday 10th July, 2006
|
|
|
|
|
Well the other link is for vector you need to customize it, i feel that we need to customize it for list.
sort void sort();<br />
Sorts the list elements in ascending order. The comparison operator < ("less than") must be defined for the list element type. Note that the STL sort algorithm does NOT work for lists; that's why a sort member function is supplied.<br />
nums.sort(); <br />
If we provide the < than operator for the struct its fine i guess.
Regards,
FarPointer
Blog:FARPOINTER
-- modified at 13:34 Monday 10th July, 2006
|
|
|
|
|
Harold_Wishes wrote: This program for the first link is not compiling...
Why not? What compiler error are you receiving?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Well, I hate to place it here, but there were 14 errors.
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(23) : error C2955: 'list' : use of class template requires template argument list
c:\program files\microsoft visual studio\vc98\include\list(415) : see declaration of 'list'
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(23) : error C2133: 'mylist' : unknown size
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(23) : error C2512: 'list' : no appropriate default constructor available
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(23) : error C2262: 'mylist' : cannot be destroyed
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(28) : error C2662: 'push_back' : cannot convert 'this' pointer from 'class std::list' to 'class std::list<_Ty,_A> &'
Reason: cannot convert from 'class std::list' to 'class std::list<_Ty,_A>'
Conversion requires a second user-defined-conversion operator or constructor
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(30) : error C2662: 'push_back' : cannot convert 'this' pointer from 'class std::list' to 'class std::list<_Ty,_A> &'
Reason: cannot convert from 'class std::list' to 'class std::list<_Ty,_A>'
Conversion requires a second user-defined-conversion operator or constructor
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(33) : error C2663: 'sort' : 2 overloads have no legal conversion for 'this' pointer
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(36) : error C2955: 'list' : use of class template requires template argument list
c:\program files\microsoft visual studio\vc98\include\list(415) : see declaration of 'list'
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(36) : error C2955: 'list' : use of class template requires template argument list
c:\program files\microsoft visual studio\vc98\include\list(415) : see declaration of 'list'
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(36) : error C2663: 'begin' : 2 overloads have no legal conversion for 'this' pointer
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(36) : error C2512: 'const_iterator' : no appropriate default constructor available
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(36) : error C2262: 'citer' : cannot be destroyed
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(37) : error C2663: 'end' : 2 overloads have no legal conversion for 'this' pointer
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(39) : error C2228: left of '.m_iData' must have class/struct/union type
Error executing cl.exe.
Sort.exe - 14 error(s), 0 warning(s)
#include <list>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
class MyData
{
public:
int m_iData;
string m_strSomeOtherData;
};
bool MyDataSortPredicate(const MyData& lhs, const MyData& rhs)
{
return lhs.m_iData < rhs.m_iData;
}
int main()
{
list mylist;
MyData data;
data.m_iData = 3;
mylist.push_back(data);
data.m_iData = 1;
mylist.push_back(data);
mylist.sort(MyDataSortPredicate);
for (list::const_iterator citer = mylist.begin();
citer != mylist.end(); ++citer)
{
cout << (*citer).m_iData << endl;
}
return 0;
}
-- modified at 13:48 Monday 10th July, 2006
|
|
|
|
|
|
I still could not get it to run.
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(33) : error C2664: 'void __thiscall std::list<class mydata,class="" std::allocator<class="" mydata=""> >::sort(struct std::greater<class mydata="">)' : cannot convert parameter 1 from '
bool (const class MyData &,const class MyData &)' to 'struct std::greater<class mydata="">'
No constructor could take the source type, or constructor overload resolution was ambiguous
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(36) : error C2955: 'list' : use of class template requires template argument list
c:\program files\microsoft visual studio\vc98\include\list(415) : see declaration of 'list'
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(36) : error C2955: 'list' : use of class template requires template argument list
c:\program files\microsoft visual studio\vc98\include\list(415) : see declaration of 'list'
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(36) : error C2440: 'initializing' : cannot convert from 'class std::list<class mydata,class="" std::allocator<class="" mydata=""> >::iterator' to 'class std::list<_Ty,_A>::const_iter
ator'
No constructor could take the source type, or constructor overload resolution was ambiguous
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(36) : error C2262: 'citer' : cannot be destroyed
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(37) : error C2679: binary '!=' : no operator defined which takes a right-hand operand of type 'class std::list<class mydata,class="" std::allocator<class="" mydata=""> >::iterator' (
or there is no acceptable conversion)
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(39) : error C2228: left of '.m_iData' must have class/struct/union type
Error executing cl.exe.
Sort.exe - 7 error(s), 0 warning(s)
#include <list>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
class MyData
{
public:
int m_iData;
string m_strSomeOtherData;
};
bool MyDataSortPredicate(const MyData& lhs, const MyData& rhs)
{
return lhs.m_iData < rhs.m_iData;
}
int main()
{
list<MyData> mylist;
MyData data;
data.m_iData = 3;
mylist.push_back(data);
data.m_iData = 1;
mylist.push_back(data);
mylist.sort(MyDataSortPredicate);
for (list::const_iterator citer = mylist.begin();
citer != mylist.end(); ++citer)
{
cout << (*citer).m_iData << endl;
}
return 0;
}
-- modified at 14:21 Monday 10th July, 2006
|
|
|
|
|
Change it in the for loop also .
Regards,
FarPointer
Blog:FARPOINTER
|
|
|
|
|
I decided to pick this apart and comment out the for loop because it is still not obvious to me where the problem is. The for loop seems to declare a pointer and initialize it to point to the beginning of the list and simply prints each item on screen until the pointer reaches the end.
That aside I notice there appears to be some conversion type error in the line above with mylist.sort(MyDataSortPredicate); See error message below.
c:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(33) : error C2664: 'void __thiscall std::list<class mydata,class="" std::allocator<class="" mydata=""> >::sort(struct std::greater<class mydata="">)' : cannot convert parameter 1 from '
bool (const class MyData &,const class MyData &)' to 'struct std::greater<class mydata="">'
No constructor could take the source type, or constructor overload resolution was ambiguous
Error executing cl.exe.
Sort.exe - 1 error(s), 0 warning(s)
mylist.sort(MyDataSortPredicate);
|
|
|
|
|
See here for the STL fix.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Harold_Wishes wrote: // Dump the list to check the result
for (list::const_iterator citer = mylist.begin();
citer != mylist.end(); ++citer)
{
cout << (*citer).m_iData << endl;
}
Don't write your own loop for this.
void printData(const MyData& data)
{
cout << data.m_iData << endl;
}
for_each(myList.begin(), myList.end(), printData);
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
This worked. But I still have commented out the code that is suppose to do the sort---> mylist.sort(MyDataSortPredicate);
C:\Documents and Settings\WoodallH\Desktop\C++\Project 6 Nesty tag\Sort.cpp(38) : error C2664: 'void __thiscall std::list<class MyData,class std::allocator<class MyData> >::sort(struct std::greater<class MyData>)' : cannot convert parameter 1 from '
bool (const class MyData &,const class MyData &)' to 'struct std::greater<class MyData>'
No constructor could take the source type, or constructor overload resolution was ambiguous
Error executing cl.exe.
-- modified at 15:03 Monday 10th July, 2006
|
|
|
|
|
You can either use the general sort algorithm (std::sort ) or write a specialized less<MyData>() functor that looks something like:
struct std::less<MyData>
{
bool operator()(const MyData& lhs, const MyData& rhs)
{
return lhs.m_iData < rhs.m_iData;
}
};
And then call mylist.sort(std::less<MyData>) .
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|