TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Matt Schellhaas
date: 1995-10-19 15:36:24
subject: problem getting task lis

I am having a bit of trouble with this code.. It is supposed to get the
task list from the system and print out the 1st task running.  It
compiles without warnings or errors, but sys 3175's every time it runs..

Being that I am an extreme beginner to os/2 programming, I am not sure
what the problem is here..

Here is the code:

___------------------------------------------

#define INCL_DOSSESMGR
#define INCL_WINSWITCHLIST

#include 
#include 
#include 
#include 
#include 
#include 
#include 

HAB hab;
HWND hwndframe;
ULONG cbitems, cbbuf;
ULONG pbase;
PSWBLOCK pswblk;
SEL sel;
char c;
PSZ buffer;
PVOID my;

int main()
{
    
    DosAllocMem((PPVOID)pbase, (ULONG)40000, PAG_READ | PAG_WRITE);
    
    cbitems = WinQuerySwitchList(hab, NULL, 0);  //Get # of items

    cbbuf   = cbitems *sizeof(SWENTRY) + sizeof(HSWITCH);
    
    DosSubAllocMem((PVOID)pbase,
               (PVOID)pswblk,
                (ULONG)cbbuf);
    
    WinQuerySwitchList(hab, pswblk, cbbuf);
    printf("name of #1 item running
%s",pswblk->aswentry[0].swctl.szSwtitle);
    return (0);
}

___---------------------------------------------------------

Please note that this is being compiled under watcom c 10.5 as an os/2
32bit text mode program and it is almost directly from the os/2 toolkit
samples..


Thanks

-Matt Schellhaas
[Team OS/2]

E-mail: c2mxsche{at}fre.fsu.umd.edu
___
 X QMPro 1.51 X He who laughs last probably doesn't understand the joke.

--- Maximus/2 2.02
* Origin: OS/2 Shareware BBS, Fairfax, VA: 703-385-4325 (1:109/347)
SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 109/347 716 3615/50 396/1 270/101 712/515 711/808 809 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™.