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

150 lines
6.5 KiB
HTML
Raw Permalink 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 a customized list of iSeries objects" />
<meta name="DC.Relation" scheme="URI" content="rzaiksoadisplaycustobjlist.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="soasamplprog1" />
<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 a customized list of iSeries objects</title>
</head>
<body id="soasamplprog1"><a name="soasamplprog1"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Sample program: Displaying a customized list of iSeries™ objects</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
#define APP_PROFILE "APPPROF" // Application profile name
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
cwbCO_SysHandle hSystemHandle; // System object handle
unsigned int rc; // System Object Access return codes
unsigned short sortIDs[] = { CWBSO_SFL_SORT_UserData,
CWBSO_SFL_SORT_Priority };
// Array of sort IDs
unsigned short actionIDs[] = { CWBSO_ACTN_PROPERTIES };
// Array of action IDs
//******************************************************************
// 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 sort/filter criteria.
// Create a list of spooled files on system SYSNAME
CWBSO_CreateListHandleEx(hSystemHandle,
CWBSO_LIST_SFL,
&amp;hList);
// Identify the name of the application profile
CWBSO_SetListProfile(hList, APP_PROFILE);
// Create an error handle
CWBSO_CreateErrorHandle(&amp;hError);
// Load previous filter criteria
CWBSO_ReadListProfile(hList, hError);
// Only show spooled files on printer P3812 for user TLK
CWBSO_SetListFilter(hList, CWBSO_SFLF_DeviceFilter, "P3812");
CWBSO_SetListFilter(hList, CWBSO_SFLF_UserFilter, "TLK");
// Sort by 'user specified data', then by 'output priority'
CWBSO_SetListSortFields(hList, sortIDs, sizeof(sortIDs) / sizeof(short));
//*******************************************************************
// Customize the UI by disabling selected UI functions. Set the list title.
//*******************************************************************
// Do not allow users to change list filter
CWBSO_DisallowListFilter(hList);
// Do not allow the 'properties' action to be selected
CWBSO_DisallowListActions(hList, actionIDs, sizeof(actionIDs) / sizeof(short));
// Set the string that will appear in the list title bar
CWBSO_SetListTitle(hList, "Application Title");
//*******************************************************************
// Display the list.
//*******************************************************************
// Display the customized list of spooled files
rc = CWBSO_DisplayList(hList, hInstance, nCmdShow, &amp;hWnd, hError);
// If an error occurred, display a message box
if (rc == CWBSO_ERROR_OCCURRED)
CWBSO_DisplayErrMsg(hError);
else
{
// Dispatch messages for the list window
while(GetMessage(&amp;msg, NULL, 0, 0))
{
TranslateMessage(&amp;msg);
DispatchMessage(&amp;msg);
}
// List window has been closed - save filter criteria in application profile
CWBSO_WriteListProfile(hList, hError);
}
//*******************************************************************
// Processing complete - clean up and exit.
//*******************************************************************
// 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="rzaiksoadisplaycustobjlist.htm" title="In this example, a list object for a list of iSeries spool files is created. After setting the desired sort and filter criteria, the list is displayed to the user, with the user interface customized so that certain user actions are disabled.">Displaying a customized list of iSeries objects</a></div>
</div>
</div>
</body>
</html>