|
Is that in the first go through of the while loop?
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
This untested code should go through the tree, starting at the supplied HTREEITEM, looking for the first occurance of the text.
HTREEITEM MyTree::FindItem (CString text, HTREEITEM start)
{
HTREEITEM child = NULL;
while (start && GetItemText(start) != text)
{
child = GetChildItem(start);
while (child && GetItemText(child) != text)
{
child = FindItem(text, child);
if (!child)
child = GetNextSiblingItem(child);
}
if (child)
break;
start = GetNextSiblingItem(start);
}
if (GetItemText(start) == text)
return start;
return child;
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Hi there,
I would like to know how a derived class from CEdit can receive command notifications directly? By directly I mean without having to be listening to messages in the parent window.
Can someone please drop me a line?
Thanks,
David
|
|
|
|
|
Check out the ON_CONTROL_REFLECT and ON_CONTROL_REFLECT_EX macros.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Ohhh! Thanks for the reply PJ! I was beginning to feel desperate...
So it is true then... the stupid commands are sent to the parent window and cannot be listened anyother way, can they?
Can I also ask: how can I make my CEdit -derived class know when the content (the input text) of the control has changed? Is there a better way of knowing this without having to use message_reflection techniques?
Again, thanks a million!!
David
|
|
|
|
|
If you want the your control class to handle it's own messages then you have to use message reflection.
dNimrod#X wrote:
how can I make my CEdit-derived class know when the content (the input text) of the control has changed? Is there a better way of knowing this without having to use message_reflection techniques?
No, you have to use message reflection. Handle either the reflected EN_UPDATE or EN_CHANGE message to handle text changes in your edit control.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks a lot PJ!!
You have been very helpful indeed!
dNimrod#X
________________________
|
|
|
|
|
Is it possible to check if something is downloding from internet?
I Need to check from my MFC App if somthing is downloding from internet.
Please help me someone.
\Larsson
|
|
|
|
|
On a global scale, I'd use a proxy. Since a user can download using FTP,HTTP etc.I would need to make a proxy for each. However, an app can also copy a file using it's own "protocol". zso, there is no easy way to get notified of every type of download.
Bikram Singh
|
|
|
|
|
yes
a pretty hard way:
if you know api hooking you can hook urldownloadtofile function you can find it in urlmon.dll and when something downloads you can display a message box on the screen and you can allow the download by letting it return what it wants or make it return a error and thus end the download before it begins. But of course they might still be downloading throught plain winsock instead of urldownloadtofile and you should probably try to hook some functions like recv also.
a even harder one wich I never did just heard about:
if you don't you can write a driver with the use of the winddk that acts just like a driver but filters connections.
I know no other ways but there might be lots
for more info on api hooking search here on codeproject a article by a russian person and also one by a chinese person but I forgot their names sorry.
One article is something about disabeling ctrl alt del and contains a very good api hooking class.
you should look at that.
|
|
|
|
|
Thanks,
I will look in to this and I hope it will work, If you have any more information please feel free to help me.
|
|
|
|
|
Hi everyone,
Hot to show two dialogs simultaneously from a CMainFrame class?
I hope that they help me.
Ivan Cachicatari
www.latindevelopers.com
|
|
|
|
|
As long as the dialog boxes are modeless I guess you could just make two calls to Create and position the dialogs in a tiled fashion so neither overlaps the other???
Cheers
How do I print my voice mail?
|
|
|
|
|
|
Hi all, I'm writing an expression parser using Baur and Zamelzon algorithm, but it seems that it can't handle unary minuses correctly What shall I do, does anybody know some algorithm that can parse unary minuses correctly ? Don't offer reverse notation, it has the same problem
|
|
|
|
|
I dont know if this is the right place to post this .
Using Chris Maunder's MFC Grid control 2.25
I need to use it in an SDI application .
and I need to create it dynamically .
I didnt know how to do this .
Plus I need the Grid in a class that is already derived from CWnd
CSCreen(derived from CWnd)
^
|
|
CMyNewClassWithMFCGrid
Has anybody have any tips on doing this ?
Thanks
|
|
|
|
|
I have a win32 dll which is called by a GUI app . Once the dll is called, a whole ton of work is done in it and then it returns, and the app is done. This takes a long time and since my dll is not an mfc one, I dont have any progressbar window popping up. (Actually I dont even know if you can have guis in a dll). How do I indicate the progress in my dll? The main app has absolutely no idea of how long things will take.
Thanks,
sb
|
|
|
|
|
ns wrote:
(Actually I dont even know if you can have guis in a dll)
Yes you can.
ns wrote:
How do I indicate the progress in my dll?
How you do it (thie GUI) is completely dependent on the nature of the long operation
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
The right (imho) approach to solving this common problem is to make the GUI an "observer" of the "worker" DLL. The worker notifies its observers of various "events" (typically progress) as it does its thing. The observer can choose to ignore these events or respond to them in any way it sees fit.
An "event" is anything that describes an action - it can be as simple as an int or as complex as a class containing several members such as event type, percentage progress, and other information describing the worker's current state.
An observer is nothing but an interface that exposes a method like:
bool handleEvent
(Event* pEvent);
The observer returns false if it wants the worker to stop further processing. Using this simple design pattern, you could implement a user-friendly task timer/progress dialog as described in this[^] article. What could be cooler?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Isn't that somewhat re-inventing the wheel since the Win32 Progress Control already implements the pattern?
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
palbano wrote:
the Win32 Progress Control already implements the pattern?
Huh?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
I think you may have misunderstood my point.
It's good design to dissociate a worker (whether it's a thread or just a helper function) from the GUI. A worker simply relays information about its state to interested parties, at significant points in time.
The observer pattern abstracts the mechanism of event delivery. An observer can be anything - a GUI (i.e. a CView or CDialog class which will likely update a progress control), a logger (which could log events to a persistent store), an alterter (which could terminate the worker under certain conditions), a profiler (which instruments the worker's operation), etc. The observer/event mechanism I alluded to is OS-agnostic. It doesn't post Windows messages - it simply relays events.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
I think you may have misunderstood my point.
No, but i understand why it looks that way
I don't acutally disagree with your point.
It just seems that posting windows messages is the same as relaying events and the relationship between a progress control and a worker thread is very similar to the Pattern.
So i thought i would post the question and see what others thought about it. I am certainly not implying your post was wrong. I apologize if it looked that way.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
http://www.codeproject.com/threads/usingworkerthreads.asp[^]
I think what Ravi had in mind was you placing a worker thread function in your DLL. Have that thread post progress messages back to your main GUI app. The main GUI app will update the progress bar.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|