ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzaik_5.4.0.1/rzaiksoasamplprog2.htm

144 lines
6.1 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="Sample program: Displaying the Properties view of an object" />
<meta name="DC.Relation" scheme="URI" content="rzaiksoadisppropview.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="soasamplprog2" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Sample program: Displaying the Properties view of an object</title>
</head>
<body id="soasamplprog2"><a name="soasamplprog2"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Sample program: Displaying the Properties view of an object</h1>
<div><div class="example"> <pre>
#ifdef UNICODE
#define _UNICODE
#endif
#include &lt;windows.h&gt; // Windows APIs and datatypes
#include "cwbsoapi.h" // System Object Access APIs
#include "cwbrc.h" // iSeries DPC APIs
#include "cwbun.h" // iSeries Navigator APIs
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
{
MSG msg; // Message structure
HWND hWnd; // Window handle
cwbRC_SysHandle hSystem; // System handle
CWBSO_LIST_HANDLE hList = CWBSO_NULL_HANDLE; // List handle
CWBSO_ERR_HANDLE hError = CWBSO_NULL_HANDLE; // Error handle
CWBSO_OBJ_HANDLE hObject = CWBSO_NULL_HANDLE; // Object handle
cwbCO_SysHandle hSystemHandle; // System object handle
unsigned long listSize = 0; // List size
unsigned short listStatus = 0; // List status
unsigned int rc; // System Object Access return codes
//*******************************************************************
// Start a conversation with iSeries server SYSNAME. Specify
// application name APPNAME.
//******************************************************************
cwbUN_GetSystemHandle((char *)"SYSNAME", (char *)"APPNAME", &amp;hSystemHandle);
cwbRC_StartSysEx(hSystemHandle, &amp;hSystem);
//*******************************************************************
// Create a list of spooled files. Set desired filter criteria.
//*******************************************************************
// Create a list of spooled files on system SYSNAME
CWBSO_CreateListHandleEx(hSystemHandle,
CWBSO_LIST_SFL,
&amp;hList);
// Only include spooled files on printer P3812 for user TLK
CWBSO_SetListFilter(hList, CWBSO_SFLF_DeviceFilter, "P3812");
CWBSO_SetListFilter(hList, CWBSO_SFLF_UserFilter, "TLK");
//*******************************************************************
// Open the list.
//*******************************************************************
// Create an error handle
CWBSO_CreateErrorHandle(&amp;hError);
// Open the list of spooled files
rc = CWBSO_OpenList(hList, hError);
// If an error occurred, display a message box
if (rc == CWBSO_ERROR_OCCURRED)
CWBSO_DisplayErrMsg(hError);
else
{
//*****************************************************************
// Display the properties of the first object in the list
//*****************************************************************
// Get the number of objects in the list
CWBSO_GetListSize(hList, &amp;listSize, &amp;listStatus, hError);
if (listSize &gt; 0)
{
// Get the first object in the list
CWBSO_GetObjHandle(hList, 0, &amp;hObject, hError);
// Display the properties window for this object
CWBSO_DisplayObjAttr(hObject, hInstance, nCmdShow, &amp;hWnd, hError);
// Dispatch messages for the properties window
while(GetMessage(&amp;msg, NULL, 0, 0))
{
TranslateMessage(&amp;msg);
DispatchMessage(&amp;msg);
}
// Properties window has been closed - delete object handle
CWBSO_DeleteObjHandle(hObject);
}
}
//*******************************************************************
// Processing complete - clean up and exit.
//*******************************************************************
// Close the list
CWBSO_CloseList(hList, hError);
// Clean up handles
CWBSO_DeleteErrorHandle(hError);
CWBSO_DeleteListHandle(hList);
// End the conversation started by EHNDP_StartSys
cwbRC_StopSys(hSystem);
//********************************************************************
// Return from WinMain.
//********************************************************************
return rc;
}
</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaiksoadisppropview.htm" title="A list object for a list of iSeries spool files is created. After setting the desired filter criteria, the list is opened, and a handle to the first object in the list is obtained. A properties view that shows the attributes for this object is displayed to the user.">Displaying the Properties view for an iSeries Object</a></div>
</div>
</div>
</body>
</html>