How to get list of immediate child directories

Hi Experts:

I'd like to get a list of directories (not all sub-directories, but only the 
immediate child directories). For example, if I'm in C:\WUTemp, and there is 
two sub-directories: C:\WUTemp\dir1 and C:\WUTemp\dir2; I should get a list 
of directories like this:

C:\WUTemp\dir1
C:\WUTemp\dir2

Thanks in Advance!
Polaris


0
etpolaris (100)
6/30/2006 9:40:19 PM
vc.mfc 33608 articles. 0 followers. Follow

21 Replies
561 Views

Similar Articles

[PageSpeed] 28

Take a look at CFileFind.  You can check to see if the file found is a 
folder and you don't have to drill down.  In fact, you'd have to go to a lot 
of trouble to build a recursive routine that does drill down into 
sub-folders.

Tom

"Polaris" <etpolaris@hotmail.com> wrote in message 
news:utwJG3InGHA.1280@TK2MSFTNGP03.phx.gbl...
> Hi Experts:
>
> I'd like to get a list of directories (not all sub-directories, but only 
> the immediate child directories). For example, if I'm in C:\WUTemp, and 
> there is two sub-directories: C:\WUTemp\dir1 and C:\WUTemp\dir2; I should 
> get a list of directories like this:
>
> C:\WUTemp\dir1
> C:\WUTemp\dir2
>
> Thanks in Advance!
> Polaris
>
> 


0
tserface (3860)
6/30/2006 11:10:01 PM
"Polaris" <etpolaris@hotmail.com> wrote in message 
news:utwJG3InGHA.1280@TK2MSFTNGP03.phx.gbl...
> Hi Experts:
>
> I'd like to get a list of directories (not all sub-directories, but only 
> the immediate child directories). For example, if I'm in C:\WUTemp, and 
> there is two sub-directories: C:\WUTemp\dir1 and C:\WUTemp\dir2; I should 
> get a list of directories like this:
>
> C:\WUTemp\dir1
> C:\WUTemp\dir2

In addition to Tom's answer - if you'd like a non-MFC solution, take a look 
at FindFirstFile, FindNextFile and FindClose in the MSDN docs.

You can identify directories by checking the dwFileAttributes field of the 
WIN32_FIND_DATA structure to see if FILE_ATTRIBUTE_DIRECTORY is set.  e.g.

<untested code>

WIN32_FIND_DATA wfd;
HANDLE hFind = FindFirstFile("c:\WUTemp\*", &wfd);
if (hFind != INVALID_HANDLE_VALUE)
{
  do
  {
     if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
     {
         // This is a directory.  wfd.cFileName has the name
     }
  } while (FindNext(hFind, &wfd));
   FindClose(hFind);
}

</untested code>

-cd


0
7/1/2006 12:39:13 AM
Thanks for your help. I have tried the non-MFC way and it worked great!

Polaris

"Polaris" <etpolaris@hotmail.com> wrote in message 
news:utwJG3InGHA.1280@TK2MSFTNGP03.phx.gbl...
> Hi Experts:
>
> I'd like to get a list of directories (not all sub-directories, but only 
> the immediate child directories). For example, if I'm in C:\WUTemp, and 
> there is two sub-directories: C:\WUTemp\dir1 and C:\WUTemp\dir2; I should 
> get a list of directories like this:
>
> C:\WUTemp\dir1
> C:\WUTemp\dir2
>
> Thanks in Advance!
> Polaris
>
> 


0
etpolaris (100)
7/1/2006 3:55:12 PM
"Carl Daniel [VC++ MVP]" <cpdaniel_remove_this_and_nospam@mvps.org.nospam>
wrote:

>"Polaris" <etpolaris@hotmail.com> wrote:
>> Hi Experts:
>>
>> I'd like to get a list of directories (not all sub-directories, but only 
>> the immediate child directories). For example, if I'm in C:\WUTemp, and 
>> there is two sub-directories: C:\WUTemp\dir1 and C:\WUTemp\dir2; I should 
>> get a list of directories like this:
>>
>> C:\WUTemp\dir1
>> C:\WUTemp\dir2
>
>In addition to Tom's answer - if you'd like a non-MFC solution, take a look 
>at FindFirstFile, FindNextFile and FindClose in the MSDN docs.

CFindFile is not MFC, it is WTL.  Much lighter weight, and usable by
itself.  WTL should be in the toolbox of every Windows programmer.
-- 
- Tim Roberts, timr@probo.com
  Providenza & Boekelheide, Inc.
0
timr3123 (27)
7/2/2006 12:52:37 AM
"Tim Roberts" <timr@probo.com> wrote in message 
news:236ea2pj47v3d00s719ihamm6o30egtqng@4ax.com...
>
> CFindFile is not MFC, it is WTL.  Much lighter weight, and usable by
> itself.  WTL should be in the toolbox of every Windows programmer.

I stand corrected.  WTL is indeed much lighter than MFC.

Unfortunately, it's not in every windows programmers toolbox since it's not 
part of any Visual C++ product offering.

-cd


0
7/3/2006 3:18:59 PM
Certainly "parts" of ATL/WTL are available in any of the Visual Studio 2005 
packages that have MFC/ATL, but for the whole thing you can download from 
here:

http://www.microsoft.com/downloads/details.aspx?FamilyID=48cb01d7-112e-46c2-bb6e-5bb2fe20e626&DisplayLang=en

That said, my guess is that since this isn't totally included it may not be 
totally supported as time goes on.  In fact, at this sight it states that it 
is not supported by Microsoft.  I'm assuming MSFT will support whatever 
parts they include in MFC.

Tom

"Carl Daniel [VC++ MVP]" <cpdaniel_remove_this_and_nospam@mvps.org.nospam> 
wrote in message news:OpeLcOrnGHA.4496@TK2MSFTNGP04.phx.gbl...
> "Tim Roberts" <timr@probo.com> wrote in message 
> news:236ea2pj47v3d00s719ihamm6o30egtqng@4ax.com...
>>
>> CFindFile is not MFC, it is WTL.  Much lighter weight, and usable by
>> itself.  WTL should be in the toolbox of every Windows programmer.
>
> I stand corrected.  WTL is indeed much lighter than MFC.
>
> Unfortunately, it's not in every windows programmers toolbox since it's 
> not part of any Visual C++ product offering.
>
> -cd
>
> 


0
tserface (3860)
7/3/2006 5:27:34 PM
"Tom Serface" <tserface@msn.com> wrote:

>Certainly "parts" of ATL/WTL are available in any of the Visual Studio 2005 
>packages that have MFC/ATL, but for the whole thing you can download from 
>here:
>
>http://www.microsoft.com/downloads/details.aspx?FamilyID=48cb01d7-112e-46c2-bb6e-5bb2fe20e626&DisplayLang=en
>
>That said, my guess is that since this isn't totally included it may not be 
>totally supported as time goes on.

WTL is now a sourceforge project (http://wtl.sourceforge.net).  On the
whole, that probably means it will have more support and a longer lifetime
than many proprietary libraries.
-- 
- Tim Roberts, timr@probo.com
  Providenza & Boekelheide, Inc.
0
timr3123 (27)
7/4/2006 4:32:58 AM
Tim Roberts wrote:
> WTL is now a sourceforge project
> (http://wtl.sourceforge.net).  On the whole, that
> probably means it will have more support and a longer
> lifetime than many proprietary libraries.

Or the contrary..



0
xfkt (15)
7/4/2006 7:16:15 AM
Polaris wrote:
> Hi Experts:
> 
> I'd like to get a list of directories (not all sub-directories, but only the 
> immediate child directories). For example, if I'm in C:\WUTemp, and there is 
> two sub-directories: C:\WUTemp\dir1 and C:\WUTemp\dir2; I should get a list 
> of directories like this:
> 
> C:\WUTemp\dir1
> C:\WUTemp\dir2
> 
> Thanks in Advance!
> Polaris
> 
> 

For a portable solution I suggest you take a look at Boost Filesystem Library 
http://www.boost.org/libs/filesystem/doc/index.htm

/David
0
7/4/2006 8:49:06 AM
I'm not sure about that, but I wish it a long life none the less :o)

Tom

"Tim Roberts" <timr@probo.com> wrote in message 
news:2nrja2p3gvl3gh0tdcmguaf7gau61v0lr8@4ax.com...
> "Tom Serface" <tserface@msn.com> wrote:
>
>>Certainly "parts" of ATL/WTL are available in any of the Visual Studio 
>>2005
>>packages that have MFC/ATL, but for the whole thing you can download from
>>here:
>>
>>http://www.microsoft.com/downloads/details.aspx?FamilyID=48cb01d7-112e-46c2-bb6e-5bb2fe20e626&DisplayLang=en
>>
>>That said, my guess is that since this isn't totally included it may not 
>>be
>>totally supported as time goes on.
>
> WTL is now a sourceforge project (http://wtl.sourceforge.net).  On the
> whole, that probably means it will have more support and a longer lifetime
> than many proprietary libraries.
> -- 
> - Tim Roberts, timr@probo.com
>  Providenza & Boekelheide, Inc. 


0
tserface (3860)
7/4/2006 3:11:37 PM
Actually, nobody would pay me for anything done in WTL; my clients want MFC code.  So I
have no motivation to learn a technology that has no marketplace.
					joe

On Mon, 3 Jul 2006 08:18:59 -0700, "Carl Daniel [VC++ MVP]"
<cpdaniel_remove_this_and_nospam@mvps.org.nospam> wrote:

>"Tim Roberts" <timr@probo.com> wrote in message 
>news:236ea2pj47v3d00s719ihamm6o30egtqng@4ax.com...
>>
>> CFindFile is not MFC, it is WTL.  Much lighter weight, and usable by
>> itself.  WTL should be in the toolbox of every Windows programmer.
>
>I stand corrected.  WTL is indeed much lighter than MFC.
>
>Unfortunately, it's not in every windows programmers toolbox since it's not 
>part of any Visual C++ product offering.
>
>-cd
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
7/6/2006 9:30:19 PM
Hi Joe,

I do almost everything with MFC as well, but I think we get some WTL with it 
so perhaps our clients are getting some WTL "for free" so to speak.

Tom

"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:860ra2hu43e4qmfq3jolr4kbdlg7sae75b@4ax.com...
> Actually, nobody would pay me for anything done in WTL; my clients want 
> MFC code.  So I
> have no motivation to learn a technology that has no marketplace.
> joe


0
tserface (3860)
7/6/2006 10:22:24 PM
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:860ra2hu43e4qmfq3jolr4kbdlg7sae75b@4ax.com...
| Actually, nobody would pay me for anything done in WTL; my clients want 
MFC code.  So I
| have no motivation to learn a technology that has no marketplace.
| joe
|
| On Mon, 3 Jul 2006 08:18:59 -0700, "Carl Daniel [VC++ MVP]"
| <cpdaniel_remove_this_and_nospam@mvps.org.nospam> wrote:
|
| >"Tim Roberts" <timr@probo.com> wrote in message
| >news:236ea2pj47v3d00s719ihamm6o30egtqng@4ax.com...
| >>
| >> CFindFile is not MFC, it is WTL.  Much lighter weight, and usable by
| >> itself.  WTL should be in the toolbox of every Windows programmer.
| >
| >I stand corrected.  WTL is indeed much lighter than MFC.
| >
| >Unfortunately, it's not in every windows programmers toolbox since it's 
not
| >part of any Visual C++ product offering.
| >
| >-cd
| >
| Joseph M. Newcomer [MVP]
| email: newcomer@flounder.com
| Web: http://www.flounder.com
| MVP Tips: http://www.flounder.com/mvp_tips.htm

MFC is already loaded in the OS 99.9999999999999999999999 percent of the 
time anyway;  why worry about it's weight?  Hung over from the embedded 
days, perhaps?  IMO, adding the weight of WTL is more of an impact than just 
using MFC which is already there.

Get a grip... (8^>

-- Ed.

-----------------------------------------------------
hex->bin->b64
F9E7707A2AF502D0A899C6ACB43A2D35EB7E

0
Anon3258 (180)
7/6/2006 10:27:35 PM
Indeed, I find the whole concept of "lightweight" vs. "heavyweight" largely pointless. Who
cares?  We have entirely too much cultural baggage from the era of the PDP-11 which we
need to discard, and program size is high among pointless concerns nearly all of the time.
Data size matters; program size is irrelevant.  I have little patience with anyone who
suddenly starts arguing about how programs in language x or technology y are "smaller"
than some other technology.  Even code speed is largely irrelevant 95% of the time (but
oh, when it matters, it matters a LOT!), and program size is also irrelevant in this case
because the tight loop is usually a few hundred lines of code at most.  Program size
doesn't matter, and code size doesn't matter, because neither have any significant impact;
what matters is just the optimum execution path through that tight loop.

In fact, I know someone who essentially says "executable size is irrelevant.  The only
thing that matters is disk accesses for data", because in the problem domain he works in,
computing is essentially free and disk access, several orders of magnitude slower, is the
ONLY operational parameter they care about.  Let's just say that in his problem domain,
terabyte databases are considered rather small and quaint.  
				joe

On Thu, 6 Jul 2006 15:27:35 -0700, "Ed Weir \(ComCast\)" <Anon@Maus.duh> wrote:

>"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
>news:860ra2hu43e4qmfq3jolr4kbdlg7sae75b@4ax.com...
>| Actually, nobody would pay me for anything done in WTL; my clients want 
>MFC code.  So I
>| have no motivation to learn a technology that has no marketplace.
>| joe
>|
>| On Mon, 3 Jul 2006 08:18:59 -0700, "Carl Daniel [VC++ MVP]"
>| <cpdaniel_remove_this_and_nospam@mvps.org.nospam> wrote:
>|
>| >"Tim Roberts" <timr@probo.com> wrote in message
>| >news:236ea2pj47v3d00s719ihamm6o30egtqng@4ax.com...
>| >>
>| >> CFindFile is not MFC, it is WTL.  Much lighter weight, and usable by
>| >> itself.  WTL should be in the toolbox of every Windows programmer.
>| >
>| >I stand corrected.  WTL is indeed much lighter than MFC.
>| >
>| >Unfortunately, it's not in every windows programmers toolbox since it's 
>not
>| >part of any Visual C++ product offering.
>| >
>| >-cd
>| >
>| Joseph M. Newcomer [MVP]
>| email: newcomer@flounder.com
>| Web: http://www.flounder.com
>| MVP Tips: http://www.flounder.com/mvp_tips.htm
>
>MFC is already loaded in the OS 99.9999999999999999999999 percent of the 
>time anyway;  why worry about it's weight?  Hung over from the embedded 
>days, perhaps?  IMO, adding the weight of WTL is more of an impact than just 
>using MFC which is already there.
>
>Get a grip... (8^>
>
>-- Ed.
>
>-----------------------------------------------------
>hex->bin->b64
>F9E7707A2AF502D0A899C6ACB43A2D35EB7E
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
7/7/2006 12:16:59 AM
I always wonder about the value of "portable" solutions in Windows-based programs. Exactly
what other platform is the code going to run on...?
					joe

On Tue, 04 Jul 2006 10:49:06 +0200, David D <dadaREMOVE@alagazamTHIS.net> wrote:

>Polaris wrote:
>> Hi Experts:
>> 
>> I'd like to get a list of directories (not all sub-directories, but only the 
>> immediate child directories). For example, if I'm in C:\WUTemp, and there is 
>> two sub-directories: C:\WUTemp\dir1 and C:\WUTemp\dir2; I should get a list 
>> of directories like this:
>> 
>> C:\WUTemp\dir1
>> C:\WUTemp\dir2
>> 
>> Thanks in Advance!
>> Polaris
>> 
>> 
>
>For a portable solution I suggest you take a look at Boost Filesystem Library 
>http://www.boost.org/libs/filesystem/doc/index.htm
>
>/David
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
7/7/2006 12:20:59 AM
Compare, for example, MFC::CEvent and ATL::CEvent (or other such wrappers 
for critical sections and files). You'll see which is lightweight or 
heavyweight. It's not binary code size issue, it's level of brain damage; 
which of them hurts more.

"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:bi9ra2114h5dcr26hng669ncrnhbt0alvr@4ax.com...
> Indeed, I find the whole concept of "lightweight" vs. "heavyweight" 
> largely pointless. Who
> cares?  We have entirely too much cultural baggage from the era of the 
> PDP-11 which we
> need to discard, and program size is high among pointless concerns nearly 
> all of the time.
> Data size matters; program size is irrelevant.  I have little patience 
> with anyone who
> suddenly starts arguing about how programs in language x or technology y 
> are "smaller"
> than some other technology.  Even code speed is largely irrelevant 95% of 
> the time (but
> oh, when it matters, it matters a LOT!), and program size is also 
> irrelevant in this case
> because the tight loop is usually a few hundred lines of code at most. 
> Program size
> doesn't matter, and code size doesn't matter, because neither have any 
> significant impact;
> what matters is just the optimum execution path through that tight loop.
>
> In fact, I know someone who essentially says "executable size is 
> irrelevant.  The only
> thing that matters is disk accesses for data", because in the problem 
> domain he works in,
> computing is essentially free and disk access, several orders of magnitude 
> slower, is the
> ONLY operational parameter they care about.  Let's just say that in his 
> problem domain,
> terabyte databases are considered rather small and quaint.
> joe
>
> On Thu, 6 Jul 2006 15:27:35 -0700, "Ed Weir \(ComCast\)" <Anon@Maus.duh> 
> wrote:
>
>>"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
>>news:860ra2hu43e4qmfq3jolr4kbdlg7sae75b@4ax.com...
>>| Actually, nobody would pay me for anything done in WTL; my clients want
>>MFC code.  So I
>>| have no motivation to learn a technology that has no marketplace.
>>| joe
>>|
>>| On Mon, 3 Jul 2006 08:18:59 -0700, "Carl Daniel [VC++ MVP]"
>>| <cpdaniel_remove_this_and_nospam@mvps.org.nospam> wrote:
>>|
>>| >"Tim Roberts" <timr@probo.com> wrote in message
>>| >news:236ea2pj47v3d00s719ihamm6o30egtqng@4ax.com...
>>| >>
>>| >> CFindFile is not MFC, it is WTL.  Much lighter weight, and usable by
>>| >> itself.  WTL should be in the toolbox of every Windows programmer.
>>| >
>>| >I stand corrected.  WTL is indeed much lighter than MFC.
>>| >
>>| >Unfortunately, it's not in every windows programmers toolbox since it's
>>not
>>| >part of any Visual C++ product offering.
>>| >
>>| >-cd
>>| >
>>| Joseph M. Newcomer [MVP]
>>| email: newcomer@flounder.com
>>| Web: http://www.flounder.com
>>| MVP Tips: http://www.flounder.com/mvp_tips.htm
>>
>>MFC is already loaded in the OS 99.9999999999999999999999 percent of the
>>time anyway;  why worry about it's weight?  Hung over from the embedded
>>days, perhaps?  IMO, adding the weight of WTL is more of an impact than 
>>just
>>using MFC which is already there.
>>
>>Get a grip... (8^>
>>
>>-- Ed.
>>
>>-----------------------------------------------------
>>hex->bin->b64
>>F9E7707A2AF502D0A899C6ACB43A2D35EB7E
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm 


0
alegr (1131)
7/7/2006 3:44:41 AM
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:h6ara2d91f7ctddmiv531l1b29j9jp436u@4ax.com...
|I always wonder about the value of "portable" solutions in Windows-based 
programs. Exactly
| what other platform is the code going to run on...?
| joe

Funny YOU should ask...
http://www.mainsoft.com/

Now we don't have to worry so much about the endians and sizeof()'s sneaking 
up to wipe us out...
Oh, NO!!  UNICODE!!!   AAhhhhhhgh

| On Tue, 04 Jul 2006 10:49:06 +0200, David D <dadaREMOVE@alagazamTHIS.net> 
wrote:
|
| >Polaris wrote:
| >> Hi Experts:
| >>
| >> I'd like to get a list of directories (not all sub-directories, but 
only the
| >> immediate child directories). For example, if I'm in C:\WUTemp, and 
there is
| >> two sub-directories: C:\WUTemp\dir1 and C:\WUTemp\dir2; I should get a 
list
| >> of directories like this:
| >>
| >> C:\WUTemp\dir1
| >> C:\WUTemp\dir2
| >>
| >> Thanks in Advance!
| >> Polaris
| >>
| >>
| >
| >For a portable solution I suggest you take a look at Boost Filesystem 
Library
| >http://www.boost.org/libs/filesystem/doc/index.htm
| >
| >/David
| Joseph M. Newcomer [MVP]
| email: newcomer@flounder.com
| Web: http://www.flounder.com
| MVP Tips: http://www.flounder.com/mvp_tips.htm 

0
Anon3258 (180)
7/7/2006 3:59:59 AM
"Alexander Grigoriev" <alegr@earthlink.net> wrote in message 
news:OEAVreXoGHA.4152@TK2MSFTNGP04.phx.gbl...
| Compare, for example, MFC::CEvent and ATL::CEvent (or other such wrappers
| for critical sections and files). You'll see which is lightweight or
| heavyweight. It's not binary code size issue, it's level of brain damage;
| which of them hurts more.
|
[snip]

Get...  ...A...  ...Grip... 

0
Anon3258 (180)
7/7/2006 4:03:00 AM
Actually, mainsoft simulates a Windows platform, so it is effectively a Windows platform.
Also, a lot of Windows assumes little-endian representations; certainly the kernel will
not run on a big-endian machine.  So effectively mainsoft does not constitute a "separate
platform".
				joe

On Thu, 6 Jul 2006 20:59:59 -0700, "Ed Weir \(ComCast\)" <Anon@Maus.duh> wrote:

>"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
>news:h6ara2d91f7ctddmiv531l1b29j9jp436u@4ax.com...
>|I always wonder about the value of "portable" solutions in Windows-based 
>programs. Exactly
>| what other platform is the code going to run on...?
>| joe
>
>Funny YOU should ask...
>http://www.mainsoft.com/
>
>Now we don't have to worry so much about the endians and sizeof()'s sneaking 
>up to wipe us out...
>Oh, NO!!  UNICODE!!!   AAhhhhhhgh
>
>| On Tue, 04 Jul 2006 10:49:06 +0200, David D <dadaREMOVE@alagazamTHIS.net> 
>wrote:
>|
>| >Polaris wrote:
>| >> Hi Experts:
>| >>
>| >> I'd like to get a list of directories (not all sub-directories, but 
>only the
>| >> immediate child directories). For example, if I'm in C:\WUTemp, and 
>there is
>| >> two sub-directories: C:\WUTemp\dir1 and C:\WUTemp\dir2; I should get a 
>list
>| >> of directories like this:
>| >>
>| >> C:\WUTemp\dir1
>| >> C:\WUTemp\dir2
>| >>
>| >> Thanks in Advance!
>| >> Polaris
>| >>
>| >>
>| >
>| >For a portable solution I suggest you take a look at Boost Filesystem 
>Library
>| >http://www.boost.org/libs/filesystem/doc/index.htm
>| >
>| >/David
>| Joseph M. Newcomer [MVP]
>| email: newcomer@flounder.com
>| Web: http://www.flounder.com
>| MVP Tips: http://www.flounder.com/mvp_tips.htm 
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
7/7/2006 3:05:31 PM
The MFC problem with events is not a lightweight/heavyweight issue, but as you point out,
a fundamental problem in brain-dead design.  

I had two processes that were trying to communicate via CEvents, and I found that in that
implementation, there was an "optimization", that once a SetEvent had been done, any
attempt to SetEvent was ignored until a ResetEvent was executed; the MFC code had presumed
that only one thread of control was working on the event!  Talk about totally brain-dead!
					joe

On Thu, 6 Jul 2006 20:44:41 -0700, "Alexander Grigoriev" <alegr@earthlink.net> wrote:

>Compare, for example, MFC::CEvent and ATL::CEvent (or other such wrappers 
>for critical sections and files). You'll see which is lightweight or 
>heavyweight. It's not binary code size issue, it's level of brain damage; 
>which of them hurts more.
>
>"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
>news:bi9ra2114h5dcr26hng669ncrnhbt0alvr@4ax.com...
>> Indeed, I find the whole concept of "lightweight" vs. "heavyweight" 
>> largely pointless. Who
>> cares?  We have entirely too much cultural baggage from the era of the 
>> PDP-11 which we
>> need to discard, and program size is high among pointless concerns nearly 
>> all of the time.
>> Data size matters; program size is irrelevant.  I have little patience 
>> with anyone who
>> suddenly starts arguing about how programs in language x or technology y 
>> are "smaller"
>> than some other technology.  Even code speed is largely irrelevant 95% of 
>> the time (but
>> oh, when it matters, it matters a LOT!), and program size is also 
>> irrelevant in this case
>> because the tight loop is usually a few hundred lines of code at most. 
>> Program size
>> doesn't matter, and code size doesn't matter, because neither have any 
>> significant impact;
>> what matters is just the optimum execution path through that tight loop.
>>
>> In fact, I know someone who essentially says "executable size is 
>> irrelevant.  The only
>> thing that matters is disk accesses for data", because in the problem 
>> domain he works in,
>> computing is essentially free and disk access, several orders of magnitude 
>> slower, is the
>> ONLY operational parameter they care about.  Let's just say that in his 
>> problem domain,
>> terabyte databases are considered rather small and quaint.
>> joe
>>
>> On Thu, 6 Jul 2006 15:27:35 -0700, "Ed Weir \(ComCast\)" <Anon@Maus.duh> 
>> wrote:
>>
>>>"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
>>>news:860ra2hu43e4qmfq3jolr4kbdlg7sae75b@4ax.com...
>>>| Actually, nobody would pay me for anything done in WTL; my clients want
>>>MFC code.  So I
>>>| have no motivation to learn a technology that has no marketplace.
>>>| joe
>>>|
>>>| On Mon, 3 Jul 2006 08:18:59 -0700, "Carl Daniel [VC++ MVP]"
>>>| <cpdaniel_remove_this_and_nospam@mvps.org.nospam> wrote:
>>>|
>>>| >"Tim Roberts" <timr@probo.com> wrote in message
>>>| >news:236ea2pj47v3d00s719ihamm6o30egtqng@4ax.com...
>>>| >>
>>>| >> CFindFile is not MFC, it is WTL.  Much lighter weight, and usable by
>>>| >> itself.  WTL should be in the toolbox of every Windows programmer.
>>>| >
>>>| >I stand corrected.  WTL is indeed much lighter than MFC.
>>>| >
>>>| >Unfortunately, it's not in every windows programmers toolbox since it's
>>>not
>>>| >part of any Visual C++ product offering.
>>>| >
>>>| >-cd
>>>| >
>>>| Joseph M. Newcomer [MVP]
>>>| email: newcomer@flounder.com
>>>| Web: http://www.flounder.com
>>>| MVP Tips: http://www.flounder.com/mvp_tips.htm
>>>
>>>MFC is already loaded in the OS 99.9999999999999999999999 percent of the
>>>time anyway;  why worry about it's weight?  Hung over from the embedded
>>>days, perhaps?  IMO, adding the weight of WTL is more of an impact than 
>>>just
>>>using MFC which is already there.
>>>
>>>Get a grip... (8^>
>>>
>>>-- Ed.
>>>
>>>-----------------------------------------------------
>>>hex->bin->b64
>>>F9E7707A2AF502D0A899C6ACB43A2D35EB7E
>> Joseph M. Newcomer [MVP]
>> email: newcomer@flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm 
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
7/7/2006 3:07:59 PM
The point is that ATL/WTL provide many of MFC features without that brain 
damage.

"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:c2usa2pmij6id3hrsnub6vksr4o7fcg53k@4ax.com...
> The MFC problem with events is not a lightweight/heavyweight issue, but as 
> you point out,
> a fundamental problem in brain-dead design.
>
> I had two processes that were trying to communicate via CEvents, and I 
> found that in that
> implementation, there was an "optimization", that once a SetEvent had been 
> done, any
> attempt to SetEvent was ignored until a ResetEvent was executed; the MFC 
> code had presumed
> that only one thread of control was working on the event!  Talk about 
> totally brain-dead!
> joe
>


0
alegr (1131)
7/8/2006 5:03:48 AM
Reply:

Similar Artilces:

User gets married
I have a user who has just gotten married, need to know if there is a way to have to email address on one mailbox? You can leave the original SMTP address and simply add the new one to her account. You can then also set the new SMTP to be her default reply to address but any email sent to the original will still be accepted as inbound. "David Marcotte" wrote: > I have a user who has just gotten married, need to know if there is a way to > have to email address on one mailbox? David, The easiest was to accomplish this is the edit the user in Active Directory Users and...

Distribution List Recipients Receive Two Emails
I am sending mail to a distribution list. Some recipients report that they are getting the mail message twice. When I send the message to email address separately, none of the recipients get a second copy. I thought it could be email forwarding setup at the recipients end, e.g. company.com has their email server setup to forward joe@company.com email to jerry@company.com and both names are in my distribution list, but some recipients getting double emails are the only recipient at their company/domain. I have deleted and rebuilt my distribution list from scratch to ensure that there...

How to get file name on a worksheet?
How to get just file name on a cell without .xls extenion ? =MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]", CELL("filename",A1))-FIND("[",CELL("filename",A1))-5) ************ Hope it helps! Anne Troy www.OfficeArticles.com Check out the NEWsgroup stats! Check out: www.ExcelUserConference.com "UNNI" <UNNI@discussions.microsoft.com> wrote in message news:B7DCF280-9BAA-490A-BC04-963F60E1B4E0@microsoft.com... > How to get just file name on a cell without .xls extenion ? See http://w...

How to get the data from double clicking chart
Hi, Is there way to get the data if we double click on chart? Like how we get the details in Pivot table. If yes pls let me know how to do the same. Regards, Karthik ...

Can Outlook mail to groups defined in LDAP directory?
I know Outlook (and Express) can be set up to look up indivudual people in a LDAP directory. Can Outlook mail to groups defined in a LDAP directory? If so, where can I find information on the configuration, schema used, etc? Or is Outlook limited to using groups defined in the local address book? What server product is hosting the LDAP directory? -- PATRICK REED [Outlook - MVP]~~~~~~ -Microsoft Certified Professional (MCP) -Have you checked http://www.slipstick.com? -Please post your Outlook version! "John McMeeking" <jmcmeek@us.ibm.com> wrote in message new...

How to get rid of serialized nil attribute
Hello there, I've got following serializable property: [XmlElementAttribute("f", IsNullable = true)] public string[] Field { get { return _fields; } set { _fields = value; } } If that array contains null values, the serializer creates following XML code: <f>6389</f> <f d6p1:nil="true" xmlns:d6p1="http://www.w3.org/2001/ XMLSchema-instance" /> <f d6p1:nil="true" xmlns:d6p1="http://www.w3.org/2001/ XMLSchema-instance" /> ...

List of Icon Symbols
I am looking for a complete list of icon symbols used in Outlook, preferably version 2002, but I will take any list. Thanks, Chip Mitchell Robert S has some on his site http://www.howto-outlook.com/howto/icons.htm "Chip Mitchell" <anonymous@discussions.microsoft.com> wrote in message news:ba0701c48921$a054e1e0$a601280a@phx.gbl... > I am looking for a complete list of icon symbols used in > Outlook, preferably version 2002, but I will take any > list. > > Thanks, > Chip Mitchell ...

List<String>. Replace
Hello, I have a List<String> and I need to find if it contains "image/pjpeg". If yes then replace it by "image/jpeg". What is the best way to do this? I can use Contains but how to replace that particular item? Thanks, Miguel Hi Shapper! "shapper" <mdmoura@gmail.com> wrote in message news:ccbe7240-051a-4b2a-b72c-d2f01dfb5ec8@l26g2000yqd.googlegroups.com... > I have a List<String> and I need to find if it contains "image/pjpeg". > If yes then replace it by "image/jpeg". > What is the best way ...

No Tree Structure in OL 2003 Folder List for Contacts
No Tree Structure in Folder List for Contacts In the Outlook 2003 Folder List (left hand pane) I can set icons at the bottom to quickly skip back & forth. The only way to get a Tree Structure for Contacts is to Select the Folders List Icon which shows all items, Emails, Contacts etc. in the tree structure that I have set up just like Outlook 2000. If I select the Mail Icon, I see my mail folders only as expected and they are in the tree structure I have set up as expected. If I select the Contacts Icon, I see only Contacts as expected HOWEVER they are in one long list in no obvious ord...

Trying to get an ASCII string.
Hello, I have an application that extracts ASCII strings from a binary file (characters from 0 to 255). Depending on the windows code page of the user, the characters above 127 do not "mean" the same : that is normal. My problem now consists in saving that string in text format while keeping every character on a BYTE and not .Net CHAR Example : Let's say a russian guy uses my program, the tool extracts C0 F0 E3 E5 ED F2 00. (Assuming buffer contains the binary data, this is how I extract the string : ) StringBuilder sb = new StringBuilder(); ...

Start Run list erased when rebooting
I seldom shut down my WinXP computer since it reboots slowly. However I do after I get updates. The last two times I have rebooted, my list of prefilled items in the Start, Run list has been wiped out completely. There are several functions I perform from there often, so would like to stop the list getting erased. Has a recent Windows update caused this? If not, what else could have? Mich "M Skabialka" <mskabialka@NOSPAMdrc.com> wrote in message news:%23ecC3MKtKHA.4860@TK2MSFTNGP05.phx.gbl... >I seldom shut down my WinXP computer since it reboots slow...

Creating Email Distribution Lists from Category Groups
How can I populate a new/existing email distribution list with existing Category Groups of contacts? For example, I have a few hundred contacts within a specific category. How can I select all of the contacts within the category group and add them to an email distribution list? Thanks for your help. GL There is an awkward way to do this, but the question is why? If you already created categories, why not use Categories instead of DL's? They are much more reliable. Just use the By Category View, select the Category header > Actions > New message to Contact. -- Russ Valentin...

match row, then match column, then get header for that column?
I have a pricelist file with SKUs in column A and prices for different types of accounts in columns B-E. In another file, I have sales by SKU, with price paid. Now I want to add the type of account to the sales file. So, I need to find the right row in the pricelist file by matching to the SKU in the sales file, then in that row find the price paid, then get the label of the column in which that price appears. For example: - Lets say I have an entry in the sales file with SKU of ABC123, for which the customer paid $65. - Now I want to go down the list of SKUs in the pricelist until I...

Event for pick list/validation item being chosen??
Hi, I understand there is a "Worksheet_Change()" event that kicks i once a cell's value has been changed. I have a cell where to there is pick list to pick a value, but once this is done the Change() even doesn't kick in. Nor, does the calculate event. (I can't get th calculate event to work for anything, but thats besides the point Anyway, does anyone know how to access this. Essentially, i'd like t update all the other cells that reference this pick list cell when th pick list cell has been modified. The way I was going to do it was us the event, and basically do...

Combo Box Auto expand List Width
it's possible to have a Combo Box List Width (the list only not the combo box it self) to expand to fit to its contents? I am using Access 2007. No, a combo box doesn't work that way. I usually make the list width wide enough to accommodate the longest content, or the sum of the widths of all the visible columns. You can change the list width of the combo with code and change the column width for each column with code. Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia "Silvio" <Silvio@discussions.microsoft.com> wrote in message news...

Getting Compile error
Invalid use of the me keyword - when I step thru: If IsNull(Me.NextToContact.Value) Then MsgBox "You Must Fill in the required date in the NextContactDate Box" Exit Sub End if But Why? Never mind, I just transferred these code lines to my Forms.code module; Before they were in a Standard module. "JMay" wrote: > Invalid use of the me keyword - when I step thru: > > If IsNull(Me.NextToContact.Value) Then > MsgBox "You Must Fill in the required date in the NextContactDate Box" > Exit Sub > End if > > But Why? ...

Still can not get in
hello again I have already restarted the security services and that is when I would get the errors. I rebooted the computer and restarted the security services again you need to unregister the security services, register them, and then reboot..... do you have any of the CDs that came with the CRM package? the Installation Guide explains this step... -Gary "Brad" <anonymous@discussions.microsoft.com> wrote in message news:192001c3fbd7$307a2ec0$a101280a@phx.gbl... > hello again > > I have already restarted the security services and that is > when I would get th...

Distribution List Troubleshooting
I have a distribution list that I created - the list works when I type in each individual's email address separately in the "to" field. It also works when I send to each person separately. BUT when I try to use the list, only some of the addresses receive the message - others come back undeliverable host. I have deleted and recreated this list three times already, and still the same result. HELP!!!!! ...

List of Inbound Routes for Exchange 5.5 Server
I have an Exchange 5.5 Server that has almost 100 inbound routes. Is there anywhere that I can find the a list of all the routes (like the registry) and put them into a text file? Thanks Rance route print from the command line if I understand hte question... -- -- Brian Desmond Windows Server MVP desmondb@payton.cps.k12.il.us Http://www.briandesmond.com "Rancehood" <Rancehood_No_Sp_am@hotmail.com> wrote in message news:uKyIG2g3EHA.4064@tk2msftngp13.phx.gbl... > I have an Exchange 5.5 Server that has almost 100 inbound routes. Is there > anywhere that I can f...

Outlook 2003, managing large client list, new to program
Please bear with me and this long post. I work at a hair salon with a large client list. We are in the process of updating our computer, going from an old 486 using Q&A Database. It's not used for appointments, just for keeping track of client visits and any needed details such as color/perm info. Right now, we use a paper card system. Each day, the next day's client cards are pulled, their appointment time noted on the card, a "reminder" call is placed, and the cards are used the next day by the stylists. New or changed info is written by hand on the back of the ca...

MFC MDI with a c# as a child
Hell I was wondering if there is a way to put a c# (managed ofcourse) window as an MFC MDI child Thanks in advance. ...

Edit Master/Child Links
Hi All, When a subform is first setup I get the opportunity to edit the master/child relationship, but can never remember how to get back to that screen. Anyone know what I mean and can advise please. Regards. Bill. 1. Open the main form in design view. 2. Right-click the edge of the subform control, and choose Properties. 3. It's on the Data tab of the Properties box. The trick is that you need to get the properties of the subform *control*, not the properties of the form in the subform control. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users...

Getting the day for a holiday
I have set up a table for holidays such as memorial day, labor day,thanksgiving day and the day after. It has the month, week and day these holidays occur on in integer values. I need to get the day of the week out of the date. For example: Day(10/8/2007) gives me 8 when I really need 2 because it's a Monday. The same thing happens when using WeekDay function. Any good ideas out there? TIA Use Format([YourDateField],"w") -- KARL DEWEY Build a little - Test a little "Craig" wrote: > I have set up a table for holidays such as memorial day, labor ...

dump all email lists
I've done the normal google searchs etc etc, but I am still a bit confused as to how one dumps the list of email addreses that exhcange will accept. This is important as I need to stop a large amount of backwash spam that the exchange server is rejecting, after the edge mail box has accepted it. The list is required so that the edge box knows what it can and cannot accept. You're talking about LDAP lookups or validation. Shoudn't your Edge box do this automatically without having you to manually dump all the valid proxies? James Chong MCSE + Messaging, MCTS msexchangetips.blo...

Get KSPROPERTY_BDA_NODE_DESCRIPTORS in a Filterdriver once
Hi i try to get the BDA Node discriptor in a device upperfilter for a BDA device. ksProperty.Set = KSPROPSETID_BdaTopology; ksProperty.Id = KSPROPERTY_BDA_NODE_DESCRIPTORS; ksProperty.Flags = KSPROPERTY_TYPE_GET; i test in FilterDispatchPnp after IRP_MN_START_DEVICE send Irp sync down -> crash STOP 0000007E after IRP_MJ_CREATE (send sync...) -> crash 7E now my problem is, i need this befor the first IRP_MJ_DEVICE_CONTROL comes in. is there any other suggestions for me BTW: it is posible to get the node discriptor from outer with the BDA driver stand alone! th...