TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Paul Sidorsky
from: Peter Fitzsimmons
date: 1995-06-09 02:35:58
subject: Two problems.

PS> 1) What messages to I need to capture and process to 
 PS> ensure my program's window will stay "Always On Top"?  
 PS> I (think I) know how to do it, I'm just not sure the 
 PS> messages I need to do it for.

The  right way is to subclass your frame window and refuse to
be covered up.

The common way is to set up a 1 second WM_TIMER that forces you on top.

 PS> 2) Is there a way that I can switch to a specific 
 PS> session from my program? This one has me clueless.

WinSwitchToProgram().  Here's a non-pm sample:

 #include 
 #include 
 #include 
 #define INCL_WIN
 #define INCL_WINSWITCHLIST
 #include 

 /*
  * GT.C (goto session)
  *
  * This program switches to a session by name,  or lists the titles of
  * all currently running sessions.
  *
  * Usage: GT
  *        lists current tasks.
  *
  * Usage: GT 
  *        Switches to first task that has  anywhere in its name.
  *
  *
  * MSC 6.00 (5.10 prob ok),  memory model indep.
  *
  * P. Fitzsimmons. 01:20:05 Mon  07-02-1990
  */

 void cdecl main(int argc, char **argv)
 {
     USHORT num,i;
     SWBLOCK *pSwb;

     if(argc>1)
         strupr(argv[1]);
     num = WinQuerySwitchList(0L, NULL, 0);
     if(!num){
         puts("Unexpected error");
         return;
     }
     pSwb = malloc(sizeof(HSWITCH) + sizeof(SWENTRY) * num );
     num = WinQuerySwitchList(0L, pSwb,
                            sizeof(HSWITCH) + sizeof(SWENTRY) * num );
     if(argc==1)
         printf("PID  Task Title\n---------------\n");
     for(i=0; iaswentry[i].swctl.idProcess,
                pSwb->aswentry[i].swctl.szSwtitle);
         else if( strstr(strupr(pSwb->aswentry[i].swctl.szSwtitle), argv[1])){
             printf("Switching to '%s'\n",
pSwb->aswentry[i].swctl.szSwtitle);
             WinSwitchToProgram(pSwb->aswentry[i].hswitch);
             break;
         }
     }
     free(pSwb);
     if(argc==1){
         printf("\nTo switch to a program,  type '%s '\n", argv[0]);
     }
     else if(i==num){
         printf("'%s' could not be found in any of the task titles!\n",
                argv[1]);
     }
 }



--- Maximus/2 2.02p1
* Origin: Sol 3/Toronto (905)858-8488 (1:259/414)
SEEN-BY: 105/42 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: 259/414 400 99 250/702 3615/50 396/1 270/101 105/103 42 712/515
@PATH: 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™.