home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
wps
/
system
/
wpsnewf
/
wpnewf.c
< prev
next >
Wrap
Text File
|
1993-11-17
|
3KB
|
74 lines
/*
* This file was generated by the SOM Compiler.
* FileName: wpnewf.c.
* Generated using:
* SOM Precompiler spc: 1.22
* SOM Emitter emitc: 1.26
*/
/*
*
* New Program object: It closes the parent folder upon launching it
* Written by : Ghassan Salem
*
* The part that fetches the WPS hwnd relies on what the Author of PC/2
* did in his program. Many thanks.
*/
#define WPNewF_Class_Source
#define INCL_WIN
#define INCL_DOS
#define INCL_GPIBITMAPS
#define INCL_DOSERRORS
#include "WPNewF.ih"
#include <wpdesk.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#define DESKTOP_CLASS "#37" /* Class name of the "Desktop" window handle (which */
SOM_Scope HWND SOMLINK WPNewFX_wpOpen(WPNewF *somSelf,
HWND hwndCnr,
ULONG ulView,
ULONG param)
{
HWND hwndFold1,hwndFold2;
ULONG ulDepth,ulSFs;
HWND hwndFold;
UCHAR ucClass[8];
HWND hwndWPS;
HWND hwndDesktop;
HENUM henumWindows;
WPNewFData *somThis = WPNewFGetData(somSelf);
WPNewFMethodDebug("WPNewF","WPNewFX_wpOpen");
ulSFs=WinGetKeyState(HWND_DESKTOP,VK_F2);
hwndFold=WinQueryActiveWindow(HWND_DESKTOP);
hwndFold1=parent_wpOpen(somSelf,hwndCnr,ulView,param);
if(ulSFs&0x8000){ /* If F2 is Pressed, close the parent if it is
not the desktop, so let's search for the WPS desktop
Handle */
/* Get to bottommost window handle of the "Desktop" */
hwndDesktop=WinQueryWindow(HWND_DESKTOP, QW_BOTTOM);
/* Enumerate all windows at "Desktop" z-order */
henumWindows=WinBeginEnumWindows(hwndDesktop);
while(hwndWPS=WinGetNextWindow(henumWindows)){
/* Now get the class name of that window handle */
WinQueryClassName(hwndWPS, sizeof(ucClass), (PCH)ucClass);
/* DeskTop is class "#37" */
if(!strcmp(ucClass, DESKTOP_CLASS)) break;
}
WinEndEnumWindows(henumWindows); /* End enumeration */
if (!WinIsChild(hwndWPS,hwndFold)) { /*If current window is the parent of
the WPS desktop, then it is the WPS desktop */
WinSetFocus(HWND_DESKTOP,hwndFold);
WinPostMsg(hwndFold,WM_CLOSE,NULL,NULL);
}
}
WinSetFocus(HWND_DESKTOP,hwndFold1);
return(hwndFold1);
}