Groups search result 1 for winHswitchfromhapp |
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
©2002 Google