|
Also, a word of caution concerning the \n.
newlines can be \n or \r\n in text files but when outputting your results to an edit control, you will need the \r\n pair. Not that it matters but in case you start dumping your text output to a GUI I thought I'd give you a heads up since your just using a newline in your snippets.
For what it's worth...
|
|
|
|
|
thx
|
|
|
|
|
Hi,
I'm new in Visual C++ .net 2005 and I'm writing a Newsreader and i have the following problem:
on my form load event i'm reading a text file into my listview, the textfile contains about 66000 lines, so when the form loads it doesn't respond for a few seconds. I have already searched the new for an answer to my question but nothing could help me out...it also tried to use the virutal mode for the listview but I don't get on with this mode
I'm becoming desperate...so it would be very nice if someone could help me on this, maybe sending me a tutorial or a very simple sample code
thx in advance
No need to invent new thing when they already exist
|
|
|
|
|
Master Gollom wrote: textfile contains about 66000 lines
I think I know why it's taking so long to load the listview.;P
|
|
|
|
|
I also know that the 66000 lines are taking much time but there must be a way to load them faster
|
|
|
|
|
make 11 threads which load 6000 lines ? (isnt that be 11 times faster )
|
|
|
|
|
|
thanks for your answer, but i have already found this link on the net but it couldn't help me out because this code is not in vc++ .net 2005
|
|
|
|
|
I need to have a control like CDragListBox (I need dragging), but it should also have a check box and a small bitmap for each item. Is it posible (and quite easy) to add check box and bitmap to CDragListBox control?
Or should I rather use CListCtrl? What's easier to implement?
Can you give me some advice please? And by the way some samples if you have any.
~~~~
|
|
|
|
|
Pls, give me some tip
~~~~
|
|
|
|
|
I am not a code writer, except in HTML, and I don't plan on learning the super long code for a print out, or in this case a window.
So I have a program that will save files, open and make new ones (for a thing you wouldnt understand)but I dont know how to make a new window. I Have actualy read and skipped around and I know that in there the code is "Make_A_WINDOW()" but wouldn't know where to put it...
Also, I have a menu but I dont know how to link them together.
~I'm using the Microsoft Visual Studio .NET 2003 program and all (hopefuly)in visual mode.
Hmm, how do I make this stupid thing WORK!
|
|
|
|
|
Haun the 2nd wrote: How do i make another window w/o code
You close your eyes, breathe deeply (very important), and say (three times) "another window without any stupid code"
If that doesn't work, you may want to look up CWnd::Create in MSDN. I'm guessing that's not what you wanted but since this is a Visual C++/MFC discussion board, I'd have to say that CWnd::Create is the way to go around here to get create another window. I've never heard of "Make_A_WINDOW" but they don't let me out much.
.NET might have a "system.output.gui.windows.telepathy.commands.new.window.without.any.stinking.code" namespace so I would give that discussion board a try.
|
|
|
|
|
bob16972 wrote: .NET might have a "system.output.gui.windows.telepathy.commands.new.window.without.any.stinking.code"
Nice , I believe in 10 year time, might be it will part of Namespace
"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
|
|
|
|
|
Hmmm...
I wonder if I could just do 2 diffrent progrects and then some how compile them together.
Or I could just learn the code...
|
|
|
|
|
Haun the 2nd wrote: I could just learn the code...
I better you learn the code, as learning never goes waste!
"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
|
|
|
|
|
What's wrong with this code? It draws, but with great flickering. I red many articles about double buffering, but it seems that I don't understand them.
Please help. :/
void CGrafikView::OnDraw(CDC* pDC)
{
CGrafikDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO:
CRect rc;
GetClientRect(&rc);
CDC dcMem;
dcMem.CreateCompatibleDC(pDC);
CBitmap bmpMem;
bmpMem.DeleteObject();
bmpMem.CreateCompatibleBitmap( pDC, rc.right, rc.bottom );
CBitmap * oldBmp = dcMem.SelectObject( &bmpMem );
CPen penBorder( PS_SOLID, 1, crBordercolor );
CPen penNull;
penNull.CreateStockObject( NULL_PEN );
CBrush brushBg( crBgcolor );
CBrush brushFill( RGB(204,204,204) );
CBrush brushNull;
brushNull.CreateStockObject( NULL_BRUSH );
CPen * oldPen = dcMem.SelectObject( &penNull );
CBrush * oldBrush = dcMem.SelectObject( &brushBg );
dcMem.Rectangle(&rc);
dcMem.SelectObject( &penBorder );
dcMem.SelectObject( &brushFill );
dcMem.Rectangle( startX-1, startY-1, startX+uWidth+1, startY+uHeight+1 );
//--------------------------------------
pDC->BitBlt( 0, 0, rc.right, rc.bottom,
&dcMem, 0, 0, SRCCOPY ); //--------------------------------------
dcMem.SelectObject( &oldPen );
dcMem.SelectObject( &oldBrush );
dcMem.SelectObject( &oldBmp );
}
Lukas
~~~~
|
|
|
|
|
whats wrong in your code do you get error?code Can you be more specific
whitesky
|
|
|
|
|
Screen is flickering. I know that double buffering should eliminate it, but I don't know how to do this?
~~~~
|
|
|
|
|
Make sure you change the OnEraseBackground to NOT paint the background. This should be handled in your Draw code.
BOOL CYourView::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
return FALSE; // Prevent "flicker" in double buffer environments
return CScrollView::OnEraseBkgnd(pDC);
}
|
|
|
|
|
Thanks
And one thing more. I create many pens and brushes in OnDraw(). Are they created and destroyed each time OnDraw is called, or are they static objects automaticly?
void CMyView::OnDraw(CDC* pDC)
{
CRect rc;
GetClientRect(&rc);
CDC dcMem;
dcMem.CreateCompatibleDC(pDC);
CBitmap bmpMem;
bmpMem.CreateCompatibleBitmap( pDC, rc.right, rc.bottom );
CBitmap * oldBmp = dcMem.SelectObject( &bmpMem );
CPen penBorder( PS_SOLID, 1, crBordercolor );
CPen penNull;
penNull.CreateStockObject( NULL_PEN );
CBrush brushBg( crBgcolor );
CBrush brushFill( RGB(204,204,204) );
CBrush brushNull;
brushNull.CreateStockObject( NULL_BRUSH );
//....
~~~~
|
|
|
|
|
If you create objects like CPen on the stack, then they will be cleaned up when they go out of scope as normal and if you "new" them on the heap then you should delete them.
For any of these, (except stock objects) you should always call DeleteObject to free up any GDI resources held up inside (that is, after the object is selected OUT of the DC).
As normal, Windows will track any resource leaks that you miss and release them when the app is closed but it is still important to prevent them for the duration of your program in case your program runs for a considerable amount of time.
Unfortunately, there is no way to "Deselect" and object from a DC directly. The convention is to create pointers to the previous object and select them back into the DC when you done to effectively "deselect" your object. Then you call your DeleteObject etc...
CSomePen pen;
CPen* pPreviousPen=pDC->SelectObject(&pen)
//......Do whatever here
pDC->SelectObject(pPreviousPen); // Deselect our pen
pen.DeleteObject()
Of course, this is only by convention and there are different schools of thought as to whether all this is necessary anymore but I follow the Petzold/Prosise example as they give good justification and explanation.
|
|
|
|
|
Aren't objects like CPen, CBrysh, CBitmap deleted automaticly, when they're out of scope?
BTW great help from you people, thanks very much. ))
~~~~
|
|
|
|
|
Let me rephrase this statement I made to avoid confrontation...
"For any of these, (except stock objects) you should always call DeleteObject to free up any GDI resources held up inside (that is, after the object is selected OUT of the DC)."
Let it be restated like this...
"For any of these, (except stock objects) I always call DeleteObject to free up any GDI resources held up inside (that is, after the object is selected OUT of the DC) to be safe since I'm not sure if the CGdiObject calls DeleteObject internally in it's destructor".
DeleteObject is required in Win32 but like I said before, you will find differing schools of thought on how this needs to be handled using the CGdiObject and what it does with the GDI resources internally when it's destructor is called. I cannot find anyplace in the MFC source where the GDI objects are getting cleaned up but I may not be looking in the right place.
|
|
|
|
|
Hi all,
I need to check if the above applications are installed on my computer.
to check office outlook i can try to create an instance of the outlook COM object. if it fails i know it is not installed.
how can i check if Outlook express and Msn messenger are installed also?
thanks in advanced
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
YaronNir wrote: how can i check if Outlook express and Msn messenger are installed also?
well, i found out that messenger also using COM object...
all that left is how to find Outlook express?
thanks
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|