|
Whit the resource editor I've created a DialogBar whit button, combo box, check box...
When I wan't to enable/disable them I use the member variable I've create just for them and call theControlVariable.EnableWindow(TRUE);
and it's work very fine... except for push button who become enable and immediatly after disabled...
why?
thanks
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
CDialogBar uses command UI update mechanism for buttons. You should add ON_COMMAND handler in the frame class - this will solve the problem of disabled button and provide a place for code which will be executed when user pushes the button. If you want to conditionally enable/disable the button, add ON_UPDATE_COMMAND_UI as well.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Does anyone know how to get the address that internet explorer is browsing? And how to do this for multiple instances of IE? This is for a little program to monitor Web contents that is viewed on a LAN (to keep an eye on naughty students )
Thanks
Kuniva
|
|
|
|
|
Use the BeforeNavigate2 event from IE and write a Browser Helper Object DLL, this will work with every instance of IE.
Use google.com to search for "BeforeNavigate2" and "BHO", you'll find enough resources
regards
|
|
|
|
|
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
|
|
|
|