home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Pier Shareware 6
/
The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso
/
035
/
cenvi29.zip
/
PMDLL.LIB
< prev
next >
Wrap
Text File
|
1994-08-27
|
7KB
|
148 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);
}
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 SWENTRY_SIZE 100 // size of each entry in entry array
#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
lWinSizeNeeded = (lWQCount * SWENTRY_SIZE) + 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 += SWENTRY_SIZE )
lSWEntry[lCount] = BLObGet(lWQblob,lWEoffset,UWORD32);
// 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
{
// create blob to hold all the data
BLObSize(lSwEntry,SWENTRY_SIZE);
#define ORD_WIN32QUERYSWITCHENTRY 124
lResult = PMDynamicLink("PMSHAPI",ORD_WIN32QUERYSWITCHENTRY,BIT32,CDECL,pSwitchListHandle,lSwEntry);
if ( lResult == 0 ) {
// place each field in pSwitchControlData structure
undefine(pSwitchControlData);
pSwitchControlData.hwnd = BLObGet(lSwEntry,loffset=0,UWORD32);
pSwitchControlData.hwndIcon = BLObGet(lSwEntry,loffset+=4,UWORD32);
pSwitchControlData.program = BLObGet(lSwEntry,loffset+=4,UWORD32);
pSwitchControlData.process = BLObGet(lSwEntry,loffset+=4,UWORD32);
pSwitchControlData.session = BLObGet(lSwEntry,loffset+=4,UWORD32);
pSwitchControlData.visibility = BLObGet(lSwEntry,loffset+=4,UWORD32);
pSwitchControlData.jump = BLObGet(lSwEntry,loffset+=4,UWORD32);
strcpy(pSwitchControlData.title,BLObGet(lSwEntry,loffset+=4,68));
pSwitchControlData.ProgType = BLObGet(lSwEntry,loffset+=68,UWORD32);
}
return lResult;
}