TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Henk den Adel
date: 1995-03-14 22:23:16
subject: Task list

Hi All,

I should like to make a file of the task list in OS/2 2.1 GA, since
Ctrl-Ins does not copy anything to the clipboard. So a simple application
which can redirect its output to a file: tl > tl.asc would be fine.

In my ingnorance I thougth, just search for tasklist and that's it. Well,
it isn't. After some grep-ing of information I found the following program:

=============================  Snip  =========================================

#define INCL_DOSMEMMGR
#define INCL_WINSWITCHLIST
#include 

HAB hab;
HWND hwndFrame;
ULONG cbItems, cbBuf;
ULONG  pBase;
PSWBLOCK pswblk;
SEL sel;

main()
{

int i;
 DosAllocMem((PPVOID)pBase,
             (ULONG)40000,
              PAG_READ |
              PAG_WRITE);
 
 /* . */
 
  cbItems = WinQuerySwitchList(hab, NULL, 0);   /* gets num. of items */
  cbBuf = (cbItems * sizeof(SWENTRY)) + sizeof(HSWITCH);
  DosSubAllocMem((PVOID)pBase,
                 (PPVOID)pswblk,
                 (ULONG)cbBuf);
  WinQuerySwitchList(hab, pswblk, cbBuf);       /* gets struct. array */


/* This was added: */

  printf("%s\n", *pswblk.aswentry.swctl.szSwtitle);


return 0;

}

=============================  Snip  =========================================

which, since I wrote this in the echo, naturally does not work or has a
nasty bugging problem. 

pswblk is a struct, which contains a struct etc. 

 typedef struct _SWBLOCK          /* swblk */
 {
    ULONG    cswentry;
    SWENTRY aswentry[1];
 } SWBLOCK;
 typedef SWBLOCK *PSWBLOCK;

 typedef struct _SWENTRY          /* swent */
 {
    HSWITCH hswitch;
    SWCNTRL swctl;
 } SWENTRY;
 typedef SWENTRY *PSWENTRY;

 typedef struct _SWCNTRL          /* swctl */
 {
    HWND     hwnd;
    HWND     hwndIcon;
    HPROGRAM hprog;
    PID      idProcess;
    ULONG    idSession;
    ULONG    uchVisibility;
    ULONG    fbJump;
    CHAR     szSwtitle[MAXNAMEL+4];
    ULONG    bProgType;
 } SWCNTRL;

 typedef SWCNTRL *PSWCNTRL;


The problem is that the added line (printf) contains an error:

TL.C(31:19) : error EDC0110: Operand of dot operator must be a struct or a union.

It is a struct!

TL.C(31:19) : informational EDC0140: Operand has type pointer to structure _SWBLOCK.

So what?

What is wrong? The struct reference to all types of tags seems to be ok. 

Does anyone have a clue?


73 es cuagn,
 Henk

--- The-Box Point 0.15+ PC
* Origin: Lobster BBS for programmers +31 104271432 (2:286/300.1)
SEEN-BY: 105/42 620/243 624/50 711/401 409 410 413 430 807 808 809 934 955
SEEN-BY: 712/407 515 628 704 713/888 800/1 7877/2809
@PATH: 286/3 10 280/801 24/24 396/1 270/101 105/103 42 712/515 711/808 809
@PATH: 711/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™.