Enumeration Not Working.

coldfusion244

Well-known member
Joined
Nov 24, 2004
Messages
266
Location
Philadelphia
I am moving from C# and VB to C++. I am attempting to make a project that enumerates all of the open windows, returns the handle of the window, the captions and the class of the window. The problem I am running into is, it says that it connot convert ENUMWNDPROC to BOOL. In all of the examples it compiles, but if I just even try copy and paste it doesnt work for me. I must have something wrong but I am not sure. I have attached my code and hopefully someone will say "Hey sean, youre stupid just do this!". I just dont understand which setting i need to have :confused: .

Thanks guys!
 

Attachments

Figured it out... Seems as though everyone on this forum (xtremedotnettalk) only does vb... almost as no one does C++ anymore... oh well...

Anyway the answer was that I had to make my callback static and take out the EnumWindows declaration from my class.
 
Seems as though everyone on this forum (xtremedotnettalk) only does .net... almost as no one does MFC/Win32 anymore...
 
Not to state the obvious but this is a .Net forum ;) and unless you need to use C++, VB and C# are a hell of a lot easier to use and overall a more productive environment IMNSHO.

Dont take that as C++ isnt wanted here - just that its not the primary language for most folk here as far as I am aware. (perhaps more questions and postings from those who do use it may draw in a larger audience and prove me wrong - so please dont stop)
 
PlausiblyDamp said:
Not to state the obvious but this is a .Net forum ;) and unless you need to use C++, VB and C# are a hell of a lot easier to use and overall a more productive environment IMNSHO.

I guess so [minus the C++.NET reference to this being a .NET forum], though if your application needs any type of speed (I have seen many posts that need high speed computing), you almost have to go to C++. I would use C# all the time, if it werent for the (purposely) lack of pointers (unsafe marked code) being only intrinsic data types. I ran a program made in C# that found the Handle, Class, and Window Text using EnumWindows. I wrote the same program now, in C++. The C++ program runs about twice as fast (using GetTickCount).

I just wish I knew more about C++ so that I could help on this forum more. Plus I would like to start writing device drivers and such because of the lack of drivers for linux. I want to get more into OS Programming and less of the programming for the general populus. I must say that I greatly enjoyed ASM programming in ASM for embedded devices; the code just seemed so logical. I guess I just like having ultimate control ;)

Edit:
/*
There are just some things you cant do (that I know of) with VB and C#. Example being, Is it possible using VB.Net or C#.Net to talk to a usb hub controller? I am talking pure .NET, no importing C code from another source. Talking to another bluetooth device?
*/

To stop ranting, I love this forum (THE WHOLE THING, not just this section) and am glad for all the help I have received.
 
Last edited by a moderator:
I dont know if itll help anyone, but I have attached the enumeration along with a linked list example to traverse through the windows found and some of their information.
 

Attachments

Back
Top