|
finally solved
It was an error in my copy constructor for the Block and Tile classes. Because the copy constructor was const , it had to invoke const -only methods. Turns out I stuffed up the syntax and used
const int GetSomeVar()
{
return SomeVar;
}
instead of
int GetSomeVar() const
{
return SomeVar;
}
Thanks to everyone who helped.
|
|
|
|
|
Even in CEdit::PreTranslateMessage I can't meet WM_MOUSEHOVER .
No problem with CListCtrl ,
even without a call to TrackMouseEvent ,
and I'm not sure if TrackMouseEvent is necessary any more.
logics
|
|
|
|
|
WM_MOUSEHOVER is a relatively new mouse message, so I'm not surprised at all that it doesn't fire from an EDIT window (one of the golden oldies).
You could always write your own CIHandleHoveringEdit class, and handle WM_MOUSEMOVEs, etc, and a WM_TIMER you reset each time the mouse moves... and so on. Not trivial, but do-able.
Iain.
|
|
|
|
|
H havei,
I am having a CListCtrl control in my dialog box. The ClistCtrl Control is having 5 columns withe column heads.
Now what i want to do is on a button click i want the same ClistCtrl to have redraw itself withe 2 columns along with their column heading.
So what exactly i want is to dynamically change the number of columns of a ClistCtrl along with their
headings. My application is on MFC
Please tell me how to do it.
Thanks In advance.
Dhiraj
|
|
|
|
|
You can also check out the DeleteColumn API if it suits your needs.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Use the CListCtrl::DeleteColumn() function.
|
|
|
|
|
Hi all,
I want to write the content of a buffer into a stringstream. So I do the following.
HRESULT hrRead;
ULONG readLen = 0;
do
{
char writeBuffer[100] = {0};
hrRead = pOutFileStream->Read(writeBuffer, sizeof(writeBuffer), &readLen);
str.write(writeBuffer, readLen);
}while(hrRead == S_OK);
But it's write only one byte to the stream. I can't figure it out. Can you someone helps me to fix it.
Thanks
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: pOutFileStream->Read(writeBuffer, sizeof(writeBuffer), &readLen);
I am not sure, but I guess if the string in the buffer is in UNICODE format, such problem will occur.
|
|
|
|
|
Actually pOutFileStream is a IStream (I mean CComPtr<istream>) in UNICODE. I want to that stream attach to a buffer.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Well in that case, after reading from the buffer, convert the UNICODE to multi byte( use WideCharToMultiByte API ) and then set it to stringstream.
|
|
|
|
|
I'm bit confusing now sir.
I have read a stream(pOutFileStream) into a buffer. And then write that buffer content into a ostream. Actually pOutFileStream is a stream of an XML file formatted in UNICODE.
If you have any example related to that conversion please send it here.
Thanks
I appreciate your help all the time...
CodingLover
|
|
|
|
|
try this..
HRESULT hrRead;
ULONG readLen = 0;
do
{
char writeBuffer[100] = {0};
wchar_t ReadBuffer[100] = {0};
hrRead = pOutFileStream->Read(ReadBuffer, 100 , &readLen);
WideCharToMultiByte( CP_ACP, NULL, ReadBuffer, -1,writeBuffer, 100, NULL, NULL );
str.write(writeBuffer, strlen(writeBuffer));
}while(hrRead == S_OK);
|
|
|
|
|
I try what you suggest. But no luck.
My xml stream like this, <state>0</state> but the buffer only contain < in my previous code. With your suggestion, nothing is contain.
Here is my full code.
int GetStat::CopyTo(ostream& str)
{
HRESULT hrSeek, hrRead;
ULONG readLen = 0;
LARGE_INTEGER startPos = {0};
if((hrSeek = pOutFileStream->Seek(startPos, STREAM_SEEK_SET, NULL)) != S_OK)
{
LOG4CPLUS_ERROR(RF_GROUP_LOGGER, "Stream seek failed." << __FUNCTION__);
return -1;
}
do
{
char writeBuffer[256] = {0};
wchar_t ReadBuffer[100] = {0};
hrRead = pOutFileStream->Read(writeBuffer, sizeof(writeBuffer), &readLen);
str.write(writeBuffer, readLen);
}while(hrRead == S_OK);
return 0;
}
std::string GetStat::GetAsString(void)
{
stringstream str(ios::in|ios::out|ios::binary);
if(CopyTo(str) == 0)
return str.str();
return "";
}
int GetStat::Result()
{
std::string temp = GetAsString();
std::cout << temp << std::endl;
char buff[256] = {0};
sprintf(buff, "%s", temp.c_str());
}
You can find the buff in above code. In Result() method you can see I've print the output to the console. It gives the correct xml stream. But buff contain only the first character.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
I still belive this is because of the UNICODE. Did you debug and check the return value of WideCharToMultiByte() function, and if it is success what is the value in ReadBuffer , writeBuffer etc?
|
|
|
|
|
Yes I do. That function return value 1 ReadBuffer contains all zeros. WriteBuffer contains the xml stream.
In the WriteBuffer after each character it contain zero. I hope it's because of UNICODE.
Did you notice my result on console on Result() method. String variable temp prints the expected value. But when I add it to the buff it contain only < sign. In writeBuffer after that sign contain a zero. Is that effect in my case?
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: ReadBuffer contains all zeros
All zero?? Then the function dosent worked as expected isnt it...?
CodingLover wrote: In the WriteBuffer after each character it contain zero
Thats is excatly the problem. That is in the statement sprintf(buff, "%s", temp.c_str()); , the sprintf() function will stop scanning the source string when it encounters a NULL. In your case since the source string is UNICODE, the second byte will be zero and hence the sprintf() returns at that point.
BTW there is another solution for the sprintf to work with unicode strings. used "%S" instead of "%s" in the format specifier.
|
|
|
|
|
Naveen wrote: BTW there is another solution for the sprintf to work with unicode strings. used "%S" instead of "%s" in the format specifier.
I've try that too. But no luck. In that time also, no any character is added to char buffer(buff)
Please help me to solve this, I'm wired with this now.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
HRESULT hrRead; ULONG readLen = 0;
do {
char writeBuffer[100] = {0};
hrRead = pOutFileStream->Read(writeBuffer, sizeof(writeBuffer), &readLen);
if (hrRead!=S_OK) break;
str.write(writeBuffer, readLen);
} while(hrRead == S_OK);
logics
|
|
|
|
|
I try your suggestion, but no luck. Do you think it's really need. Because Read() not return S_OK if read less number of bytes than define.
And also for the second part, yes I move the pointer to the beginning of the stream.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
I get a memory leak like this on debugging (after exiting the application):
{1557} normal block at 0x00483160, 2 bytes long.
Data: <1 > 31 00
How do I exactly find out the variable (name) holding the memory
0x00483160 that causes the leak.
Note : Double-clicking on the aforementioned line doesn't show me the
place of the memory leak
Thanx in Advance.
|
|
|
|
|
|
Hi, I've been using c# for some time , but I'm new in c++ and I'm using qt.
My question is whether there is a container control in C++ like a sliding menu ( for example, tool box , server explorer, solution explorer in Visual Studio when auto-hide (stample like) button is pressed.) These menus are hidden as you know when this auto-hide option is chosen and they appear sliding towards the center of the screen when mouse is over their tab.
I want to use a control likewise in my C++ (qt) application.
I went through Qt Designer but I couldn't find an object like that
Seeking for your help, thanx
|
|
|
|
|
You can implement the behavior by using Extended MFC classes in Visual Studio 2008 Feature Pack[^]. There you can find Visual Studio, Office and Native UI components for your application.
Otherwise you'll have to write your own.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Hi,
No you cant use any MFC Classes in Qt application.
You better post this QtCenter[^]
Or
QtForum[^]
All the best..
The price of anything is the amount of life you exchange for it.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
I am using a dev++4.9 version of bloodshed compiler sofware and i am having problems with getting my source code to show up as output onn the screen. I am hopping that one of you can tell me what compiler will make the code show up. I am not rich so thinking maybe you people can tell me where i can download that kind of software.
|
|
|
|