🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1810

Re: EnumWindows etc.

#1810
From: Ed Mulroy
Date: Sun, 10 Jun 2007 14:32
98 lines
4935 bytes
> When it comes to the C code, that's super easy for me...

I misjudged you.  I thought you were new to this and missed that what you 
were new to was the vagarities of Windows and of C++.

> ...I didn't realize that HWND was available as an actual type.
> I'm assuming that's declared in windows.h???...

Yes.  Windows.h actually does a number of includes itself.  By including 
that file you get many typedefs, macros and structure definitions as well as 
the function prototypes for what Windows provides.

Note that if you are writing a VCL based program (most of what I do is not 
VCL), you probably don't need to include windows.h because vcl.h provides 
what you need.

There is one additional thing you need to know.  Long ago Microsoft did not 
support C++ so did Windows headers for old-timey C (K&R 1, pre-ANSI standard 
C).  These days functions prototypes are checked against use of those 
functions for proper argument lists.  If you get an error on the EnumProc 
argument of EnumWindows then either put this as the first line in the file

#define STRICT

or define it under Options|Project defines.  STRICT is Microsoft's 
workaround to alter the expansion of windows.h to support the "new" way 
stuff has been done (since the late 80's! ).

.  Ed

> Matthew wrote in message
> news:466b6796$1@newsgroups.borland.com...
>
>>Ok, a structure to use in a doubly linked list:
>>
>>struct WindowData
>>    {
>>    HWND hwnd;
>>    AnsiString caption;
>>    WindowData *prev_item;
>>    WindowData *next_item;
>>    };
>>
>
>>However that means you must allocate each node (each
>> instance of the structure), keep copies of the addresses of
>> the first and current items and adjust the links yourself.
>> However doing a linked list yourself is a lot of coding and
>> I don't see how this task needs an actual linked list rather
>> than a simple array.
>
> When it comes to the C code, that's super easy for me. I have
> a forest class that I've been using for years to organize
> data, and all the handling routines are already in place
> including virtual functions that do some simple but cool
> tasks.
>
> And yeah - an array will do the same... I'm just used to
> using the link classes I've used for years. The forest class
> I built allows each node to link to infinite nodes. The hard
> part in building that was a method to collapse the forest
> without memory loss... :) [e.g. it's not doubly linked, it's
> infinitely linked] - and I had to develop it for number theory
> and simulated annealing multi-depth related paradigms.
>
> I don't usually mess around with windows functions. I usually
> just write code to crunch numbers = primes, pi, etc... in
> an attempt to do it as fast as possible.
>
> As for the struct:
>
>>    HWND hwnd;
>>    AnsiString caption;
>
> That's what I needed. Thank you very much. I didn't realize
> that HWND was available as an actual type. I'm assuming
> that's declared in windows.h???
>
>>  http://msdn2.microsoft.com/en-us/Library
>>
>>I have some programming pages posted with links to tutorials and other
>>information.  Look at them and see if they help:
>>  http://www.mulroy.org/programg.htm
>>
>>> Once I have the state of the window, what API call do I use
>>> to maximize or minimize it?
>>
>>Look at the function ShowWindow
>>  http://msdn2.microsoft.com/en-us/library/ms633548.aspx
>>
>>.  Ed
>
> The ShowWindow is the last key to what I need.
>
> You have been a great help. I will take a look at all the
> links. From here, I think I know what I need.
>
> You are much appreciated!
Technical Details
Message-ID: <466c0b8d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder.ecngs.de!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4668d902$1@newsgroups.borland.com> <l2ri63pmm23tsci1u4subhitr6cchmm147@4ax.com> <4669fbaf$1@newsgroups.borland.com> <466aacf2$1@newsgroups.borland.com> <466aefff$1@newsgroups.borland.com> <466b4b25$1@newsgroups.borland.com> <466b54ac$1@newsgroups.borland.com> <466b5915$1@newsgroups.borland.com> <466b6796$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,859e738ad5fa0eae
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ed Mulroy" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4668d902$1@newsgroups.borland.com> <l2ri63pmm23tsci1u4subhitr6cchmm147@4ax.com> <4669fbaf$1@newsgroups.borland.com> <466aacf2$1@newsgroups.borland.com> <466aefff$1@newsgroups.borland.com> <466b4b25$1@newsgroups.borland.com> <466b54ac$1@newsgroups.borland.com> <466b5915$1@newsgroups.borland.com> <466b6796$1@newsgroups.borland.com>
Subject: Re: EnumWindows etc.
Date: Sun, 10 Jun 2007 10:32:27 -0400
Lines: 100
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 69.141.82.147
Message-ID: <466c0b8d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1181485965 69.141.82.147 (10 Jun 2007 07:32:45 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder.ecngs.de!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail