|
http://codeguru.earthweb.com/ieprogram/enumIE.html
there you go... 90% of your work is done!
|
|
|
|
|
wow! thanks, this is all i need!
Kuniva
Want, take, have.
(oh btw, best way of learning some language is by looking at examples, start large!) :p
|
|
|
|
|
Hi
I want to count the number of lines in a textfile.
I know how to open and read from a file, but how can I read exactly line after line?
regards
|
|
|
|
|
Are you using FILE*, MFC's CFile, standard C++ iostreams, or pure Win32 CreateFile?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I'm familar with FILE* and CFile.
If possible, I'd like to use pure Win32 without MFC
|
|
|
|
|
If possible, I'd like to use pure Win32 without MFC
You'll have to look for line breaks yourself - Win32 API doesn't differentiate between 'binary' and 'text' files. Call ReadFile in the loop until EOF and search for \n in the input buffer.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Ok thanks I will try
Is there an easier way with MFC?
|
|
|
|
|
Is there an easier way with MFC?
Yes, there is. Use CStdioFile, pass CFile::typeText when opening the file, and call CStdioFile::ReadString until you reach EOF. Each ReadString reads one line of text.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Works fine
Tomorrow I'll try the Non-MFC way
|
|
|
|
|
I use the following in a number of apps
if ( !(m_pLogFile = fopen(lpFileName, "a+")) )
which will create a file if it doesn't exist, or if it does, append to the end of the file. Very handy for log files and such. In another app, I'm using a CFile object
CFileException exFileError;
if ( !m_fileExtract.Open( m_strQualifiedPathAndFilename, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::shareExclusive, &exFileError ) )
and the no matter what various combinations of options I specify, I can not get it to append to an existing file. Is this something that is missing from the CFile class, and if it is, I welcome suggestions for how to do appending to an existing file.
Thanks.
Chris
|
|
|
|
|
Maybe you should move the file pointer to the end of file? modeNoTruncate combined with modeCreate should open the file if it already exist without erasing its contents. Try calling SeekToEnd after Open.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Tomasz, you are always on the ball!
I'm just looking into various positioning methods of the CFile class and expect that is what I'll try. I was expecting CFile to have an 'append' option for the Open method and since there isn't, I'll have to do it myself.
Thanks for the help, again
Chris
|
|
|
|
|
i am having a problem with tool tips displaying slowly.
At first i thought they were not working. but i found i left my mouse over the control for about a second the tip came up. After that all the tooltips for the objects beside them, as long as i did not lose focus of any, came up fast.
I have an onnotify message
ON_NOTIFY_EX(TTN_NEEDTEXT,0,OnToolTipNotify)
and it does not init for about 1 sec after i move to the control. Also if i keep moving the mouse over the control it will not init. I have to stop
I hope this makes sense.
thank you:
confused:
|
|
|
|
|
TTN_NEEDTEXT is sent just before tooltips shows itself. Did you try to change the activation time with CToolTipCtrl::SetDelayTime?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
i have declared
CToolTipCtrl m_tooltip;
then call
m_tooltip.SetDelayTime(0);
and get the following compile error
'CToolTipCtrl::SetDelayTime' : illegal call of non-static member function
i know i am probably doing something incorrectly or in the wrong order
but i am not sure what
|
|
|
|
|
Funny. It should compile without much problems. Try this:
m_tooltip.SetDelayTime(500, TTDT_INITIAL);
m_tooltip.SetDelayTime(250, TTDT_RESHOW);
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
that does compile ok
thank you
|
|
|
|
|
My application need to connect to a time server and retrieve the current time. I have no idea how to do that. Anyone can give me a hint?
RT
|
|
|
|
|
For starters, you can read up on the Time Protocol. Then it's just a matter of writing code to connect to a time server. I'm sure there are plenty of examples out there on how to do this. Just search google, or perhaps even here on Code Project.
[Update] Sorry I can't be of more help right now. I'll try to get back to you in a few hours.
Jon Sagara
I can't think of anything original to say.
|
|
|
|
|
Hi All,
I am considering getting a Windows debug tool such as BoundsChecker (the only such program that I am even a little familiar with).
I am looking for opinions on the usefulness of these tools, and specific recommendations for products. Who are BoundsChecker's competitors? I seem to recall a tool called Purify, but can' really think of much else.
It seems like the market for these tools is diminishing (there aren't even any adds for debuggers in recent issues of MSDN magazine). Is this because the debugger in Visual Studio is good enough?
Any opinions and advice will be greatly appreciated.
Thanks very much,
Sean
|
|
|
|
|
I rely on BC to help out when things get tricky. VC's debugger (at least in VC6) can't catch the things BC can: dangling pointers, resource and global memory leaks, array out of bounds, uninitialized, etc..
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
I use BoundsChecker. For me is all that I need for debug my programs, detect memory leaks, optimization of codes, etc.
I personally think that never will change the bounschecker of other tool.
It's only my opinion.
Carlos Antollini.
When is Friday?
In three days Bob....
|
|
|
|
|
The debugger in VC6 is pretty decent (I wish it would expand macros and reveal the value of constants). Boundschecker sometimes falsely identifies memory leaks, but is good at pointing out where leaks might be occurring in other code (Stingray libraries for instance).
It's a good add-on, but I only use it as a last resort, and as a last resort tool, I don't see it was being worth the relatively excessively high price.
To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
|
|
|
|
|
We used BC for quite a while as a 'final check' of the code, but we no longer use it because of the excessive upgrade costs - each new version is an expensive addition, and the features have changed very little. Since BC 5 doesn't integrate with VC 6, we no longer use it.
-----------------------
The sermon on the mount...
Man 1 : Hear that? Blessed are the greek.
Man 2 : The greek?
Man 1 : Well apparently, he's going to inherit the earth.
Man 2 : Did anyone catch his name?
|
|
|
|
|
BoundsChecker, Purify and other diagnostic tools solve slightly different problems than built-in debugger in VC6. They are used for pinpointing errors like memory/resource leaks and invalid parameters passed to Windows API. The built-in debugger is for watching stack/variables/memory etc. Sure, there's some leak detection built into C/C++ runtime, but it's a basic level only.
I've used both BoundsChecker and Purify - and Purify is my favorite program. However, I think you should check it yourself before spending hard-earned cash. Both programs have free evaluation versions on the web.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|