TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Mark Birenbaum
date: 1996-08-04 11:42:28
subject: Getting info about windows

OK folks, I've just started to learn about writing PM apps, and to start
off,I tried to write a little program to list all windows, and whether or
not the window is visible.  The following program does go through the
windows, and tell me if they're visible or not, but when I try to get the
window title, it returns an empty string.  Why?  I'm using VAC++.

---------------------------

#define INCL_WINMESSAGEMGR      /* Window Message Functions     */ #define
INCL_WINWINDOWMGR       /* Window Manager Functions     */

#include 
#include 
#include 

void main(int argc, char *argv[]){
    HWND Current;
    CHAR Title[256];
    HAB hab;
    HENUM  henum;            /* enumeration handle                   */
    HMQ   hmq;

    hab = WinInitialize(0);          /* initialize PM */
    hmq = WinCreateMsgQueue(hab, 0); /* create default size queue */
    henum=WinBeginEnumWindows(HWND_DESKTOP)  /* get an enumaration handle */

    while ((Current = WinGetNextWindow(henum)) != NULLHANDLE){
        if (WinQueryActiveWindow(HWND_DESKTOP) == Current){
            printf("Currently active window, ");
        }
        WinQueryWindowText(Current,256,Title);
        printf("%s",Title);
        if (WinIsWindowShowing(Current))
            printf(" is showing\n");
        else
            printf(" is hidden\n");
    }

    WinEndEnumWindows(henum);
    WinDestroyMsgQueue(hmq);
    WinTerminate(hab);
}

-!- IceEdit v1.75  [Eval]

--- Maximus/2 3.01
* Origin: The Foundation - (403) 436-1345 / 437-1617 - (1:342/620)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1
@PATH: 342/620 5011 61 3615/50 396/1 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.