Go to Google Groups Home
Groups 
 
 • Advanced Groups Search
 • Groups Help
 
Groups search result 1 for winHswitchfromhapp

Search Result 1
From: David MacMahon (davidm@ccnet.com)
Subject: Re: HAPP from WinStartApp
Newsgroups: comp.os.os2.programmer.misc
View: Complete Thread (4 articles) | Original Format
Date: 1996/09/13
In <516ji0$emf@camel0.mindspring.com>, DEH@ writes:
>Besides WinTerminateApp, can the HAPP from WinStartApp be used in any 
>other calls to get more info about the launched application ? I found a 
>#define for ORD_WINHSWITCHFROMHAPP in bseord.h, but nothing else.

Here's an old article I've saved from Uri Stern:

>>> BEGIN ENCLOSED ARTICLE <<<
Argh!  I tried posting a response to this append last night, but my NewsReader
trapped right as I clicked the Post pushbutton.  In any case, there is an 
undocumented API in the PMSHAPI dynamic link library called WinHSWITCHfromHAPP
that will do exactly what you need.  The workplace shell uses this API internally.
The function will take a session identifier/app handle (HAPP) as a parameter and 
return a switch handle (HSWITCH) for the started application.  Here is a piece of 
sample code that makes use of it along with the prototype.

// the ordinal is 209
#pragma import(WINHSWITCHFROMHAPP,,"PMSHAPI", 209)                           
HSWITCH APIENTRY16 WINHSWITCHFROMHAPP (HAPP happ);                           

// Sample code starts here
    
happ = WinStartApp(NULLHANDLE,              // Notification window handle                                
                   &progdetails,            // Program Details Structure                                 
                   NULL,                    // Command Line Parameters for the started application       
                   NULL,                    // Reserved                                                  
                   SAF_INSTALLEDCMDLINE);   // Start Application Flags                                   

// get the switch handle from the happ                                                                                              
hswitch = WINHSWITCHFROMHAPP(happ);                                                          
                                                                                              
if (hswitch)                                                                                  
 {                               
  // if you need to you can get the switch list control structure SWCNTRL
  // which contains the pid etc...                                                           
  if (!WinQuerySwitchEntry(hswitch, &swctl))                                                  
   {                                                                                          
    DosSleep(1000);                                                                           

    // Remove the switch list entry for the started application
    WinRemoveSwitchEntry(hswitch);                                                            
   }                                                                                          
 }                                                                                             

Hope this helps, 
Uri J. Stern
President, Stern & Morrow Software Consulting, Inc.
>>> END ENCLOSED ARTICLE <<<

I have found that 155 is the ord for the 32 bit version of this function.
I use the following two lines instead:

#pragma import(WinHswitchFromHapp,,"PMSHAPI", 155)
HSWITCH APIENTRY WinHswitchFromHapp( HAPP happ);

Hope this helps,
Dave

David MacMahon
davidm@ccnet.com


Google Home - Advertise with Us - Add Google to Your Site - News and Resources - Language Tools - Jobs, Press, Cool Stuff...

©2002 Google