|
Milos Djokovic wrote:
while(!tagFound) { chPrev[0] = chCurrent[0]; this->Read(chCurrent, 1); // typeof (this) == CFile* ... rValBuffer += chCurrent; // <- here is the problem ... }
this is very Bad!! as reallocation of Memory in CString is taking place at every iteration!.. you have to come out of some better method! since you reading one char at time you can follow this strategy!
list<TCHAR> listCharacter;
list<TCHAR>::Iterator itList;
while(!tagFound) {
chPrev[0] = chCurrent[0];
this->Read(chCurrent, 1); // typeof (this) == CFile*
...
listCharacter. push_back(*chCurrent);
...
}
CString str(" ",listCharacter.size()+1);
int iCount=0;
for(itList = listCharacter.begin(), ;
itList != listCharacter.end();
itList ++)
{
str.SetAt(iCount++)=*itList ;
}
rValBuffer =str;
<div class='ForumSig'>"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you </div>
|
|
|
|
|
ThatsAlok wrote: this is very Bad!!
Agreed.
ThatsAlok wrote: as reallocation of Memory in CString is taking place at every iteration!..
Not necessarily. Take a look at the AllocBuffer() method.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Take a look at the AllocBuffer() method.
could find it anywhere! is it associated with CString
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
ThatsAlok wrote: could find it anywhere! is it associated with CString
Did you look in strcore.cpp ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello,
In my application I have a series of std::sort(begin, end, pr) calls, that lasts about 6 seconds in Release build. However, in Debug build it lasts nearly 20 minutes! I tried setting the non-debug CRT for Debug configuration (I use the multi-threaded CRT DLL), but the linker complained on not finding the CrtDbgReportW function.
It would be neat if I weren't to wait 20 minutes each time I want to debug this application.
|
|
|
|
|
When I try to get the file handle of an ifstream with _fileno, I receive the compile error
'_file' : is not a member of 'ifstream'
How else can I get the handle of an ifstream?
At the moment I need the handle to get the file length by _filelength.
How else can I get the length of an open file? I want to avoid using CFileFind, as the file is open anyway.
|
|
|
|
|
Vancouver wrote: '_file' : is not a member of 'ifstream'
that's true, since _fileno is available for c-like streams only and you are using c++ streams. Give a look to the following code snippet:
streampos size;
ifstream ifs("foo.txt");
ifs.seekg(0, ios::end);
size = ifs.tellg();
ifs.seekg(0, ios::beg);
size -= ifs.tellg();
hope that helps.
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.
|
|
|
|
|
It is like scratching the right ear with the left hand.
The file length is known and recorded somewhere during open. seekg with ios::end uses exactly that information - but how to get it directly?
I found in several sources, that the length info is not directly available; however, when looking around filebuf, I found the direct solution:
1. rdbuf delivers the pointer to filebuf
2. filebuf has the handle as file description
3. _filelength works with that file description.
I tested it.
Btw, I don't understand, why to substract the position of file beginning; is there any case, when that is not zero?
|
|
|
|
|
Vancouver wrote: It is like scratching the right ear with the left hand.
The file length is known and recorded somewhere during open. seekg with ios::end uses exactly that information - but how to get it directly?
I agree, a lit cumbersome, but your way isn't that cleaner..., moreover I don't like such hacking-like actions with class data members (only matter of style).
Vancouver wrote: Btw, I don't understand, why to substract the position of file beginning; is there any case, when that is not zero?
'cause, AFAIK nowhere (documentation) is stated that tellg() will return 0 at the beginning of the file.
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.
|
|
|
|
|
Hi all,
I have seen this article here:
http://www.codeproject.com/cs/miscctrl/NoScrollingTree.asp
and then found WM_VSCROLL is 276, which is good. But I am not able to scroll right, left, up or bottom using both methods. For instance how can I scroll to 10 pixels down?
Any help is really greatly appreciated.
Thanks all,
Light
|
|
|
|
|
Light2k6 wrote: http://www.codeproject.com/cs/miscctrl/NoScrollingTree.asp
Ask this question this articles discussion board. That author might help you.
|
|
|
|
|
I get an compiler error when I tried to compile the Cylinder Progress Control Demo files.
in "stdafx.h" this is listed but no files are available:
#include "gdiplus.h"
#pragma comment(lib, "gdiplus.lib")
// GDI+ namespace
using namespace Gdiplus;
Can anyone help! I'm using VS 6.0.
A C++ programming language novice, but striving to learn
|
|
|
|
|
|
As has been said, GDI+ came out after VC6, and so, is not included. There's a wrinkle. The PSDK has not supported VC6 for quite some time. You need to find an old copy of the PSDK to have any guarentee of it working. You'd do better to upgrade to a better compiler.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks for the info
A C++ programming language novice, but striving to learn
|
|
|
|
|
The February 2003 PSDK[^] is the last one that supports VC6. It does contain the GDI+ headers.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hi!
I've created a DLL that can be loaded into several host applications. This DLL uses MFC and I have to have a non-modal window to send messages to it. In one of the exported functions of my DLL (where all neccessary initialization is taking place) I create my non-modal window with some code similar to this:
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
m_pWin = new CNonmodal(NULL);
m_pWin->Create(IDD_DIALOG1);
m_pWin->ShowWindow(SW_SHOW); That way my window exists until I destroy it during uninitialization.
So far, so good, this works fine when the DLL is loaded into another MFC application.
But now my DLL got loaded by a VB6 application and suddenly the non-modal dialog disappears when the first form of this application (the splash screen) is closed!
The VB6 application shows a splash screen, then loads my DLL (I can see my non-modal dialog popping up briefly) and shortly afterwards closes the splash screen (unloads the form). At this moment, my non-modal dialog also disappears and I don't have any idea why.
Can anyone help?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Unfortunately, I got no replies.
Fortunately, I finally figured it out for myself, so perhaps someone else can use this information:
Since I was creating the dialog without specifying an explicit parent window, the main application window was chosen. In the case of the VB application this was the splashscreen at this moment.
Once the splash screen was closed, all child windows were deleted as well.
At first I tried replacing new CNonmodal(NULL) with new CNonmodal(CWnd::GetDesktopWindow()) , but that didn't help at all.
Still got no idea why.
Only after giving the parent window in the call to Create (m_pWin->Create(IDD_DIALOG1, CWnd::GetDesktopWindow()); ) it finally worked and the window didn't get closed anymore.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
|
I recently downloaded the XListCtrl demo and the "uxthme.h" and "tmschema.h" files are not there.
Also can someone explain where one is to place the "lib" files (in DETAIL please!).
I'm using VS 6.0.
A C++ programming language novice, but striving to learn
-- modified at 15:26 Saturday 2nd December, 2006
|
|
|
|
|
These are in the Platform SDK, but as Christian indicated above the current PSDK is not compatible with VS 6.0. (I think you have to go back to 2002 or so to get one that is.)
Visual Studio 2003 and 2005 both ship with a compatible Platform SDK. If you are learning, I suggest biting the bullet and getting either. 2005 has a much better C++ implementation, but the IDE is rather flakey for C++ development. (Still, it's enough of an improvement that I use it for all of my new C++ development; I use 2003 only for legacy apps where it isn't cost effective to move to 2005.)
If you can get hold of a copy of the full MSDN CDROMs from at least October 2001, it will have the material you need on it (somewhere in the back of my mind, I'm thinking the February 2002 is the last that will work, but I may be remembering something else.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Joe Woodbury wrote: (somewhere in the back of my mind, I'm thinking the February 2002 is the last that will work, but I may be remembering something else.)
Indeed you are. MSDN October '01 is the last one that works with VS6.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
According to PJ's reference, the Platform SDK from February 2003 was the last one to support VC 6. (http://www.qmedia.ca/launch/psdk.htm[^])
PS. I don't have VC6 installed and have no way to confirm the accuracy of this site.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I ordered the Feb 2003 PSDK from that site in order to reinstall VC6 so I could maintain an old app of mine. The PSDK was free but they charged S&H to send out the CD.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Joe Woodbury wrote: ...the Platform SDK from February 2003 was the last one to support VC 6.
True, as far as the PSDK goes. I understood your comment to be about MSDN.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|