|
I have use IPersistStreamInit to load a Html file,
then I directly return that Html data from the stream, but I have found out
all double commas had eliminated, stranged for this
Who can help me this?
|
|
|
|
|
Sorry , 'Double commas" should be 'Double qutotations'
Please Micosoft's engineer answer this problem, if having in here.
|
|
|
|
|
Hi,
I have a COM Component which has an ATL class.
Is there any way by which it is possible to write VARIANT to a binary file and read it back?
Similarly for BSTRs?
Please help..
Regards,
|
|
|
|
|
See the CComBSTR and CComVariant classes. They have Read/Write methods which operate on IStream interfaces. All you need to do is to provide a wrapper implementation of IStream , which uses your I/O functions.
--
Pictures[^] from my Japan trip.
|
|
|
|
|
Hello, I'm new here only having come across the wonderful resource recently. I've a quick question. Sorry if its very basic but I'm also very new to WTL.
I'm starting a new project in WTL and I'm mostly working off of the Alpha toolbar image sample from here. I'm trying to position a Splitter and I need to take into account the windows Rebar, but I can't figure out how the find out the height of the Rebar. RB_GETBARHEIGHT could probably do it, but I don't what hWnd I should use.
Any help would be appreciated, kind regards, Eoin.
|
|
|
|
|
|
I am trying to load a dll (Statically) into an out of proc COM exe. But as soon as I call any of the dll routines, the program crashes.
Any ideas will be greatly appreciated?
Thanks in advance.
Regards,
Misha G
|
|
|
|
|
istringstream is("hello world hello earth" );
string s,str;
str = is.str() ; //str = hello world hello earth
is >> s; //s = hello
str = is.str(); //str still = hello world hello earth
But i want the rest "world hello earth", what can I do?
|
|
|
|
|
i don't understand the question, ,so please explain it a bit better.
you only want to get the last 3 word out of the 4, or is it something else ?
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
-- modified at 3:46 Thursday 22nd December, 2005
|
|
|
|
|
yes!
I want the last all words from the current stream pos.
|
|
|
|
|
find the first white space occurence in the string.
then you call .mid() from that position to the end of the string. that will do.
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
zghelp wrote:
istringstream is("hello world hello earth" );
string s,str;
str = is.str() ; //str = hello world hello earth
is >> s; //s = hello
str = is.str(); //str still = hello world hello earth
But i want the rest "world hello earth", what can I do?
is >> s;
string s2;
getline (is, s2);
|
|
|
|
|
but what can I do with
istringstream is("hello world\n hello earth" );
when i want the rest "world\n hello earth",
|
|
|
|
|
zghelp wrote: but what can I do with
istringstream is("hello world\n hello earth" );
when i want the rest "world\n hello earth"
Try something like:
getline (is, s2, traits_type::eof());
The third argument is the 'delimiter' where getline stops.
|
|
|
|
|
hi,
i need to prepare a Add-in for Outlookexpress. Please tellme, how can i do that.
in that i need to add a menu to messagewindow
please suggest us ,how can i achieve this.
Thanks in advance
regards,
koti
spend every minute per success
|
|
|
|
|
I want skin a dialog, how can i do in WTL? but dialog class is CDialog and CAXDialog, how can i use one class finish it?
|
|
|
|
|
Hi!
I'm a newbie and trying the <list>.
I want to save the objects of this class into a list.
<br />
#ifndef HEADER<br />
#define HEADER<br />
<br />
class MyClass<br />
{<br />
private:<br />
char m_myVar1 [255]; <br />
char m_myVar2 [255]; <br />
<br />
public: <br />
MyClass();<br />
~MyClass(); <br />
const char* getMyVar1() { return m_myVar1; }<br />
const char* getMyVar2() { return m_myVar2; }<br />
};<br />
<br />
#endif<br />
Could anyone help me with some snips? Many thanks!
|
|
|
|
|
first, you create a list of the type you want to store in it :
#include <LIST>
#include "MyClass.h"
std::list<MyClass> myList;
then, you use it as a list of any other types... :
MyClass o1();
MyClass o2();
myList.add(o1);
myList.add(o2);
see what i mean ?
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
-- modified at 5:14 Thursday 22nd December, 2005
|
|
|
|
|
Thank you very much, it works!
Now I have another problem. How can I sort the list? myList.sort() doesn't work! I found some codes but they don't work properly. I don't know how to write correctly. My intention is to sort the list on m_myVar1 or m_myVar2. I would like to write a method that has these possibilities.
Do you know what I mean?
-- modified at 4:17 Thursday 22nd December, 2005
|
|
|
|
|
you have to write your own comparator (because list::sort() doesn't know how to sort your objects type) and then, pass it to sort() . this is a bit weird for newbies, i conceed.
the other way to do it (and maybe the easiest) is to add a comparison operator in your class to allow sort() to sort your objects.
for example :
<font color=blue>class</font> MyClass {
<font color=blue>private</font>:
<font color=blue>char</font> m_myVar1[255];
<font color=blue>char</font> m_myVar2[255];
<font color=blue>public</font>:
MyClass();
~MyClass();
<font color=blue>const char</font>* getMyVar1();
<font color=blue>const char</font>* getMyVar2();
<font color=green>
<font color=blue>bool operator</font> < (<font color=blue>const</font> MyClass&);
<font color=blue>bool operator</font> > (<font color=blue>const</font> MyClass&);
<font color=blue>bool operator</font> <= (<font color=blue>const</font> MyClass&);
<font color=blue>bool operator</font> >= (<font color=blue>const</font> MyClass&);
<font color=blue>bool operator</font> == (<font color=blue>const</font> MyClass&);
};
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
-- modified at 5:13 Thursday 22nd December, 2005
|
|
|
|
|
Thank you!
But I don't know how to pass it to sort().
I write my code so:
class MyClass {
private:
char m_myVar1[255];
char m_myVar2[255];
public:
MyClass();
~MyClass();
const char* getMyVar1() { return m_myVar1; }
const char* getMyVar2() { return m_myVar2; }
bool operator < (const MyClass&);
bool operator > (const MyClass&);
bool operator <= (const MyClass&);
bool operator >= (const MyClass&);
bool operator == (const MyClass&);
};
-----------
#include <LIST>
#include "MyClass.h"
int main()
{
std::list<MyClass> myList;
MyClass o1;
MyClass o2;
myList.push_back(o1);
myList.push_back(o2);
myList.sort();
return 0;
}
-- modified at 5:18 Thursday 22nd December, 2005
|
|
|
|
|
you don't pass it, sort will use them !!!
it is mentioned on the link on the msdn site i provided previously that sort() (without parameter) will sort in the ascending order...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
-- modified at 5:13 Thursday 22nd December, 2005
|
|
|
|
|
I got compiler faults: "... public: bool __thiscall MyClass::operator<(class MyClass const &)" (??MCID3@@QAE_NABV0@@Z ...."
Do I have to define these methods anywhere????
// these are for comparison
bool operator < (const MyClass&);
bool operator > (const MyClass&);
bool operator <= (const MyClass&);
bool operator >= (const MyClass&);
bool operator == (const MyClass&);
Isn't it only the prototypes????
|
|
|
|
|
nne-vitamin wrote: Do I have to define these methods anywhere????
yes of course !!
in general, we declare a class in a .h file, and implement it in a .cpp.
myclass.h:
<font color=blue>class</font> MyClass {
<font color=blue>private</font>:
<font color=blue>char</font> m_myVar1[255];
<font color=blue>char</font> m_myVar2[255];
<font color=blue>public</font>:
MyClass();
~MyClass();
<font color=blue>const char</font>* getMyVar1();
<font color=blue>const char</font>* getMyVar2();
<font color=green>
<font color=blue>bool operator</font> < (<font color=blue>const</font> MyClass&);
<font color=blue>bool operator</font> > (<font color=blue>const</font> MyClass&);
<font color=blue>bool operator</font> <= (<font color=blue>const</font> MyClass&);
<font color=blue>bool operator</font> >= (<font color=blue>const</font> MyClass&);
<font color=blue>bool operator</font> == (<font color=blue>const</font> MyClass&);
};
myclass.cpp:
MyClass::MyClass() {
<font color=green>
}
MyClass::~MyClass() {
<font color=green>
}
<font color=blue>const char</font>* MyClass::getMyVar1() {
<font color=blue>return this</font>->myVar1;
}
<font color=blue>const char</font>* MyClass::getMyVar2() {
<font color=blue>return this</font>->myVar2;
}
<font color=blue>bool</font> MyClass::operator < (<font color=blue>const</font> MyClass& crefCl) {
<font color=green>
}
<font color=blue>bool</font> MyClass::operator > (<font color=blue>const</font> MyClass& crefCl) {
<font color=green>
}
<font color=blue>bool</font> MyClass::operator <= (<font color=blue>const</font> MyClass& crefCl) {
<font color=green>
}
<font color=blue>bool</font> MyClass::operator >= (<font color=blue>const</font> MyClass& crefCl) {
<font color=green>
}
<font color=blue>bool</font> MyClass::operator == (<font color=blue>const</font> MyClass& crefCl) {
<font color=green>
}
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
-- modified at 6:35 Thursday 22nd December, 2005
|
|
|
|
|
Thank you very much! But I don't know what (the comparisons) I have to write to the definition of these classes operators?
bool MyClass::operator < (const MyClass& crefCl) { //do the comparison here...}
bool MyClass::operator > (const MyClass& crefCl) { //do the comparison here...}
bool MyClass::operator <= (const MyClass& crefCl) { //do the comparison here...}
bool MyClass::operator >= (const MyClass& crefCl) { //do the comparison here...}
bool MyClass::operator == (const MyClass& crefCl) { //do the comparison here...}
I only want my list to be sorted based on the content of m_myVar2. If the contents of m_myVar2 are:
"One"
"Two"
"Three"
"Four"
so after calling myList.sort() the contents should be alphabetically sorted like:
"Four"
"One"
"Three"
"Two"
How can I do that? If you write: //do the comparison here...
I cannot guess what.
-- modified at 6:44 Thursday 22nd December, 2005
|
|
|
|