#ifdef UNICODE #define _UNICODE #endif #include <windows.h> // 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", &hSystemHandle); cwbRC_StartSysEx(hSystemHandle, &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, &hList); // Identify the name of the application profile CWBSO_SetListProfile(hList, APP_PROFILE); // Create an error handle CWBSO_CreateErrorHandle(&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, &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(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&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; }