home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cenvi23.zip
/
PMDLL.LIB
< prev
next >
Wrap
Text File
|
1995-03-01
|
7KB
|
143 lines
/*****************************************************************************
*** PMdll.lib - This library contains wrappers functions and definitions ***
*** ver.3 used in making calls into the Presentation Manager ***
*** DLLs. This file may be #include'ed into your source ***
*** file, or you may want to improve speed and memory use by ***
*** copying just the relevant sections into your source code. *** ***
*****************************************************************************/
WinCreateObject(pClassName,pTitle,pSetupString,pLocation,pFlags)
{
// WinCreateObject: Create an instance of an object class
// pClassName: A string which contains the name of the class of which this object is a member.
// pTitle: A string which contains the initial title of the object as it is to appear
// when displayed on the user interface underneath an icon or on
// the title bar of an open object.
// pSetupString: A series of "keyname=value" pairs separated by commas, that change the behavior of the object.
// Each object class documents its keynames and the parameters parameters it expects to see immediately following.
// Note that ALL parameters have safe defaults, so it is never necessary to pass
// unnecessary parameters to an object.
// pLocation: Folder location. This can be the real folder path name or one of these:
// <WP_NOWHERE>, <WP_DESKTOP>, <WP_OS2SYS>, <WP_TEMPS>, <WP_CONFIG>, <WP_START>, <WP_INFO>, <WP_DRIVES>
// pFlags: Creation flags:
#define CO_FAILIFEXISTS 0
#define CO_REPLACEIFEXISTS 1
#define CO_UPDATEIFEXISTS 2
// Return: returns handle for object, which is NULL (0) for error, else
// handle can be used for further calls for this object
#define ORD_WINCREATEOBJECT 281
return PMDynamicLink("PMWP",ORD_WINCREATEOBJECT,BIT32,CDECL,
pClassName,pTitle,pSetupString,pLocation,pFlags)
}
WinQueryObject(pObjectID)
{
// WinQueryObject: Return a handle to the persistent ObjectID
// pObjectID: The ObjectID of an existing object, for example "<WP_DESKTOP>", or
// alternatively the fully qualified filename of any file or directory.
// Return: NULL for error, else return a handle to the object created.
// This handle is persistent and can be used for the WinSetObjectData
// and WinDestroyObject function calls.
#define ORD_WINQUERYOBJECT 252
return PMDynamicLink("PMWP",ORD_WINQUERYOBJECT,BIT32,CDECL,pObjectID);
}
WinSetObjectData(pWPObjectHandle,pSetupString)
// set parameters in SetupString for WPObjectHandle, which is like the value
// returned by WinCreateObject.
// Return TRUE for success and FALSE for error.
{
#define ORD_WINSETOBJECTDATA 250
return PMDynamicLink("PMWP",ORD_WINSETOBJECTDATA,BIT32,CDECL,pWPObjectHandle,pSetupString)
}
WinDestroyObject(pWPObjectHandle)
// destroy pWPObjectHandle as returned by WinCreateObject
// Return TRUE for success and FALSE for error.
{
#define ORD_WINCREATEOBJECT 251
return PMDynamicLink("PMWP",ORD_WINCREATEOBJECT,BIT32,CDECL,pWPObjectHandle)
}
WinSwitchToProgram(pSwitchHandle)
{
// Switch to this handle, where SwitchHandle is an entry entry handle in the window list.
// Returns 0 for success or one of the following errors:
#define INV_SWITCH_LIST_ENTRY_HANDLE 4610 // Invalid Window List entry handle of the program to be activated.
// #define NOT_PERMITTED_TO_CAUSE_SWITCH ???? // Requesting program is not the current foreground process.
#define ORD_WIN32SWITCHTOPROGRAM 131
return PMDynamicLink("PMSHAPI",ORD_WIN32SWITCHTOPROGRAM,BIT32,CDECL,pSwitchHandle);
}
WinQuerySwitchHandle(pWindowHandle,pProcessID)
{
#define ORD_WIN32QUERYSWITCHHANDLE 125
return PMDynamicLink("PMSHAPI",ORD_WIN32QUERYSWITCHHANDLE,BIT32,CDECL,
pWindowHandle,pProcessID);
}
gSwCntrlDef.hwnd = UWORD32;
gSwCntrlDef.hwndIcon = UWORD32;
gSwCntrlDef.program = UWORD32;
gSwCntrlDef.process = UWORD32;
gSwCntrlDef.session = UWORD32;
gSwCntrlDef.visibility = UWORD32;
gSwCntrlDef.jump = UWORD32;
gSwCntrlDef.title = 68;
gSwCntrlDef.ProgType = UWORD32;
WinQuerySwitchList(pAnchorBlock)
// return an array of switch list handles. Number can be determined by
// the size of the array returned, which will be NULL for an error.
{
#define FIRST_SWENTRY_OFFSET 4 // offset in returned block of first entry
#define ORD_WIN32QUERYSWITCHLIST 126
// determine how big the blob must be to hold the data received and then
// allocate it much bigger just to be sure
lWQCount = PMDynamicLink("PMSHAPI",ORD_WIN32QUERYSWITCHLIST,BIT32,CDECL,pAnchorBlock,NULL,0);
if ( lWQCount == 0 )
return NULL;
// create big big big extrabig BLOb to hold received data
lSwCntrlSize = BLObSize(gSwCntrlDef);
lWinSizeNeeded = (lWQCount * lSwCntrlSize) + FIRST_SWENTRY_OFFSET;
BLObSize(lWQblob,lWinSizeNeeded*2);
// once again, query for list of WinSwitches
lWQCount = PMDynamicLink("PMSHAPI",ORD_WIN32QUERYSWITCHLIST,BIT32,CDECL,
pAnchorBlock,lWQblob,lWinSizeNeeded * 3 / 2);
if ( lWQCount == 0 )
return NULL;
// create array for lWQCount entries to hold the Switch entries
for ( lCount = 0, lWEoffset = FIRST_SWENTRY_OFFSET; lCount < lWQCount; lCount++, lWEOffset += lSwCntrlSize )
lSWEntry[lCount] = BLObGet(lWQblob,lWEoffset,gSwCntrlDef).hwnd;
// finished, and so return this array
return lSWEntry;
}
WinQuerySwitchEntry(pSwitchListHandle,pSwitchControlData)
// Query based on this pSwitchListHandle for SwitchControl Data. Return 0 for
// success else error. Set pSwitchControlData to structure with the following
// structure members (all integers except for title):
// hwnd: Window Handle
// hwndIcon: Icon handle
// program: Program handle
// process: Process ID
// session: Session ID
// visibility: ???
// jump: ???
// title: title of this window; string
// ProgType: program type
{
#define ORD_WIN32QUERYSWITCHENTRY 124
return PMDynamicLink("PMSHAPI",ORD_WIN32QUERYSWITCHENTRY,BIT32,CDECL,
pSwitchListHandle,gSwCntrlDef,pSwitchControlData);
}