Click here to Skip to main content
15,912,578 members
Home / Discussions / C#
   

C#

 
GeneralSplitter Problem Pin
blankg17-Jun-04 13:28
blankg17-Jun-04 13:28 
GeneralRe: Splitter Problem Pin
xuhx17-Jun-04 18:48
xuhx17-Jun-04 18:48 
GeneralRe: Splitter Problem Pin
blankg17-Jun-04 23:20
blankg17-Jun-04 23:20 
GeneralRe: Splitter Problem Pin
xuhx20-Jun-04 15:17
xuhx20-Jun-04 15:17 
GeneralName servers lookup in c# Pin
smallguy17-Jun-04 11:31
smallguy17-Jun-04 11:31 
GeneralRe: Name servers lookup in c# Pin
Heath Stewart17-Jun-04 17:22
protectorHeath Stewart17-Jun-04 17:22 
GeneralRe: Name servers lookup in c# Pin
smallguy18-Jun-04 9:30
smallguy18-Jun-04 9:30 
GeneralPeopleSoft API and C# Pin
sean_carroll17-Jun-04 10:08
sean_carroll17-Jun-04 10:08 
Confused | :confused:
I'm new to C# and am having a hard time with a project I am working on. I work primarily with PeopleSoft, and we are interfacing to the PeopleSoft API via C#. I have a good example for VB 6 or C/C++, but am having problems wrapping it for C#.

Firstly, it uses a lot of #defines, not sure how to translate them into C#. Should I just use the raw codes. See below for the psmsgapi.h header file.

Secondly, many of the parameters used by the functional prototypes have structures or pointers.

Any help would be greatly appreciated!! Big Grin | :-D My email is sfcarroll@yahoo.com

An example of a C program that will do what I am trying to do:

#include <string.h>
#include <stdio.h>
#include "/opt/psoft/hr762dev/src/inc/psmsgapi.h"

void PrintError(char *);

PSMSGHANDLE hCtx;

main()
{

PSOPERATOR Opr;
int Result;
int nReplyOption;

strcpy(Opr.szOprId, "USER");
strcpy(Opr.szOprPswd, "PASSWORD");

Result = PSMsgConnect(PSMSG_APIVERSION, "10.141.136.100:8030", &Opr, &hCtx);
if (Result != PSMSG_OK)
PrintError("Error in Connect");

Result = PSMsgStartMessage(hCtx, "HS_email_processing", "HS_update_email", 0);
if (Result != PSMSG_OK)
PrintError("Error in Start Message");

Result = PSMsgSetField(hCtx, "EMPLID", "000212");
if (Result != PSMSG_OK)
PrintError("Error in Setfield on emplid");

Result = PSMsgSetField(hCtx, "HS_EMAIL_ADDRESS", "sfcarroll@yahoo.com");
if (Result != PSMSG_OK)
PrintError("Error in Setfield on email address");

Result = PSMsgSetField(hCtx, "HS_DO_NOT_EMAIL", "Y");
if (Result != PSMSG_OK)
PrintError("Error in Setfield on email check box");

Result = PSMsgProcessMessage(hCtx, &nReplyOption);
if (Result != PSMSG_OK)
PrintError("Error in Process Message");

Result = PSMsgDisconnect(hCtx);
if (Result != PSMSG_OK)
PrintError("error in disconnect");

printf("!! SUCCESS !! \n");

return (0);




HEADER FILE - psmsgapi.h

#ifndef _INC_PSMSGAPI_H /* only include psmsgapi.h once */
#define _INC_PSMSGAPI_H


/***********************************************************************
* defines *
***********************************************************************/

// the API version number to be passed in to PSMsgConnect
#define PSMSG_APIVERSION 1

// API return codes
#define PSMSG_OK 0 // operation successful
#define PSMSG_ERROR 1 // general runtime error
#define PSMSG_NOTLOADED 2 // Message Agent not present
#define PSMSG_BADCONTEXT 3 // invalid PSMSGHANDLE
#define PSMSG_NOTFOUND 4 // requested definition not found
#define PSMSG_NOMATCHINGROWS 5 // no matching rows
#define PSMSG_NOMOREAGENTS 6 // no more free agents

// reply options for PSMsgProcessMessage
#define PSMSG_NOREPLY 0
#define PSMSG_REPLY 1
#define PSMSG_FORWARD 2

// Message Agent Option Flags - Multiple options can be OR'ed
#define PSMSG_OPT_RESET 0x000 // Reset all options
#define PSMSG_OPT_CHANGEMODEADDUPDATE 0x001 // change panel mode from add to
// update if level 0 record was
// found
#define PSMSG_OPT_NOGUI 0x002 // NO LONGER SUPPORTED - Disable GUI
#define PSMSG_OPT_NOFIELDEDITS 0x004 // NOT IMPLEMENTED
// Disable Field edits. This will
// stop checking for valid values
// for fields, so use it when you
// are reading validated values
// and pushing it back into
// application tables.
#define PSMSG_OPT_FIELDORDER 0x008 // Order outputlist by how they
// appear in Field Mapping
#define PSMSG_OPT_MODE_ADD 0x010 // Action mode flags
#define PSMSG_OPT_MODE_UPDATE 0x020
#define PSMSG_OPT_MODE_UPDATEALL 0x030
#define PSMSG_OPT_MODE_CORRECTION 0x040
#define PSMSG_OPT_MODE_DATAENTRY 0x050
#define PSMSG_OPT_MODE_MASK 0x0F0
#define PSMSG_OPT_UNFORMATTED_IN 0x100 // Input data are unformatted
#define PSMSG_OPT_UNFORMATTED_IN_OFF 0x200 // turn off UNFORMATTED_IN

#define PSMSG_CHANGEMODEADDUPDATE PSMSG_OPT_CHANGEMODEADDUPDATE

#define PSMSG_SEARCHMODE_EXACT 0
#define PSMSG_SEARCHMODE_LIKE 1
#define PSMSG_SEARCHMODE_PROMPT 2

// Constants used by/for PSMsgCheckAndSetOperator() function
#define PSMSG_OPERATORLEN 8 // Operator name length

// Constants used by/for PSMsgGetFieldList() function
#define PSMSG_FIELDNAMELEN 30 // Field name length
#define PSMSG_RECNAMELEN 15

#define PSMSG_USE_UNSUPPORTED 0x00000000 // Field mapping use(s)
#define PSMSG_USE_INPUT 0x00000001
#define PSMSG_USE_OUTPUT 0x00000002
#define PSMSG_USE_BOTH 0x00000003
#define PSMSG_USE_SEARCHKEY 0x00000004
#define PSMSG_USE_FIELDKEY 0x00000008
#define PSMSG_USE_REQUIRED 0x00000100
#define PSMSG_USE_EDITXLAT 0x00000200
#define PSMSG_USE_YESNO 0x00002000
#define PSMSG_USE_EDITTABLE 0x00004000

#define PSMSG_XFR_UNSUPPORTED 0 // Field mapping transfer method(s)
#define PSMSG_XFR_COPY 1
#define PSMSG_XFR_XLATS 2
#define PSMSG_XFR_XLATL 3
#define PSMSG_XFR_REVERSE 4

#define PSMSG_TYPE_UNSUPPORTED 0 // Field type(s)
#define PSMSG_TYPE_CHAR 1
#define PSMSG_TYPE_NUMBER 2
#define PSMSG_TYPE_DATE 3
#define PSMSG_TYPE_TIME 4
#define PSMSG_TYPE_DATETIME 5

// Additional Defines For Search Dialog Processing
// Note that these values must be synched up with those #define's
// found in rdmdefs.h
#define PSMSG_USE_KEY 0x001 // RDM_KEY
#define PSMSG_USE_DUPLKEY 0x002 // RDM_DUPLKEY
#define PSMSG_USE_ALTKEY 0x010 // RDM_ALTKEY
#define PSMSG_USE_LISTITEM 0x020 // RDM_LISTITEM
#define PSMSG_USE_DESCKEY 0x040 // RDM_DESCKEY
#define PSMSG_USE_SEARCHITEM 0x800 // RDM_SEARCHITEM

// as defined in pslen.h
#define PSMSG_LONGNAMELEN 30 // RDM_LONGNAMELEN
#define PSMSG_SHORTNAMELEN 15 // RDM_SHORTNAMELEN

#define PSMSG_MAXVALUELEN 30

// the PSMSGHANDLE is a unique 32-bit context identifier given to a user of
// the PeopleSoft Message Agent API when a connection is made

#ifdef _WIN32
#define MSGAPIFUNCTION int __stdcall
#else
#define MSGAPIFUNCTION int
#endif

typedef void *PSMSGHANDLE;

const char C_fmtPSMagReady[] = "PSMAG:Ready:%s";


typedef struct
{
char szFieldName[PSMSG_FIELDNAMELEN + 1]; // Field name
int fFieldType; // Field type
// - PSMSG_TYPE_CHAR
// - PSMSG_TYPE_NUMBER
// - PSMSG_TYPE_DATE
// - PSMSG_TYPE_TIME
// - PSMSG_TYPE_DATETIME
// - PSMSG_TYPE_UNSUPPORTED
int nFieldSize; // Field size in bytes
int fFieldMapUse; // Field use attribute(s)
// - PSMSG_USE_INPUT
// - PSMSG_USE_OUTPUT
// - PSMSG_USE_BOTH
// - PSMSG_USE_SEARCHKEY
int fFieldMapTransfer; // Field method attribute(s)
// - PSMSG_XFR_COPY
// - PSMSG_XFR_XLATS
// - PSMSG_XFR_XLATL
// - PSMSG_XFR_REVERSE
int nFieldLevel; // Field's scroll level
char szEditTable[PSMSG_RECNAMELEN + 1]; // Edit Table
} PSMSGFIELDINFO;
typedef PSMSGFIELDINFO *LPPSMSGFIELDINFO;

typedef struct // Search Field Info
{
char szFieldName [PSMSG_FIELDNAMELEN + 1]; // Field name
char szLongName[PSMSG_LONGNAMELEN + 1]; // Long name
char szShortName[PSMSG_SHORTNAMELEN + 1]; // Short name
int fFieldType; // Field type
// - PSMSG_TYPE_CHAR
// - PSMSG_TYPE_NUMBER
// - PSMSG_TYPE_DATE
// - PSMSG_TYPE_TIME
// - PSMSG_TYPE_DATETIME
// - PSMSG_TYPE_UNSUPPORTED
int nFieldSize; // Size in bytes
int fFieldUse; // Field attributes in hex
// - PSMSG_USE_KEY
// - PSMSG_USE_DUPLKEY
// - PSMSG_USE_ALTKEY
// - PSMSG_USE_DESCKEY
// - PSMSG_USE_SEARCHITEM
// - PSMSG_USE_LISTITEM
char szEditTable[PSMSG_RECNAMELEN + 1]; // Edit Table
} PSMSGSEARCHFIELD;
typedef PSMSGSEARCHFIELD *LPPSMSGSEARCHFIELD;

typedef struct // Search Dialog Results
{
char szFieldName[PSMSG_FIELDNAMELEN + 1]; // Field Name
char szValue[PSMSG_MAXVALUELEN + 1]; // Field value
int nFieldNameSize; // Field's size in bytes
int nValueSize; // Value's size in bytes
} PSMSGLISTBOXFIELDINFO;
typedef PSMSGLISTBOXFIELDINFO *LPPSMSGLISTBOXFIELDINFO;

typedef struct /* logon information structure */
{
char szOprId[PSMSG_OPERATORLEN + 1];
char szOprPswd[PSMSG_OPERATORLEN + 1];
} PSOPERATOR;
typedef PSOPERATOR *LPPSOPERATOR;

/***********************************************************************
* PSMSGAPI version 1 function prototypes *
***********************************************************************/

#if defined (__cplusplus)
extern "C"
{
#endif

/* Session Level Operations */
MSGAPIFUNCTION PSMsgCheckAndSetOperator(PSMSGHANDLE hContext,
LPPSOPERATOR lpOperator);
MSGAPIFUNCTION PSMsgConnect(long lMsgAPIVersion,
const char *lpcszTopic,
LPPSOPERATOR lpOperator,
PSMSGHANDLE *lphContext);
MSGAPIFUNCTION PSMsgDisconnect(PSMSGHANDLE hContext);
MSGAPIFUNCTION PSMsgSetOptions(PSMSGHANDLE hContext,
int fOptions);

/* Processing Messages */
MSGAPIFUNCTION PSMsgStartMessage(PSMSGHANDLE hContext,
const char *lpcszActivityName,
const char *lpcszMsgName,
int bOriginatorVerified);
MSGAPIFUNCTION PSMsgProcessMessage(PSMSGHANDLE hContext,
int *lpnReplyOption);

/* Field Level Operations */
MSGAPIFUNCTION PSMsgSetField(PSMSGHANDLE hContext,
const char *lpcszFieldName,
const char *lpcszValue);
MSGAPIFUNCTION PSMsgGetMaxFieldNameLength(PSMSGHANDLE hContext,
int *lpnLength);
MSGAPIFUNCTION PSMsgGetMaxValueLength(PSMSGHANDLE hContext,
int *lpnLength);
MSGAPIFUNCTION PSMsgFindField(PSMSGHANDLE hContext,
const char *lpcszFieldName);
MSGAPIFUNCTION PSMsgFindFirstField(PSMSGHANDLE hContext);
MSGAPIFUNCTION PSMsgFindNextField(PSMSGHANDLE hContext);
MSGAPIFUNCTION PSMsgFindNextOutputRow(PSMSGHANDLE hContext);
MSGAPIFUNCTION PSMsgGetFieldCount(PSMSGHANDLE hContext,
int *lpnCount);
MSGAPIFUNCTION PSMsgGetFieldList(PSMSGHANDLE hContext,
LPPSMSGFIELDINFO lpFields);
MSGAPIFUNCTION PSMsgGetFieldNameLength(PSMSGHANDLE hContext,
int *lpnLength);
MSGAPIFUNCTION PSMsgGetFieldName(PSMSGHANDLE hContext,
char *lpszFieldName,
int nSize);
MSGAPIFUNCTION PSMsgGetValueLength(PSMSGHANDLE hContext,
int *lpnLength);
MSGAPIFUNCTION PSMsgGetValue(PSMSGHANDLE hContext,
char *lpszValue,
int nSize);

/* Error Processing */
MSGAPIFUNCTION PSMsgGetErrorExplainTextLength(PSMSGHANDLE hContext,
int *lpnLength);
MSGAPIFUNCTION PSMsgGetErrorExplainText(PSMSGHANDLE hContext,
char *lpszExplainText, int nSize);
MSGAPIFUNCTION PSMsgGetErrorFieldName(PSMSGHANDLE hContext,
char *lpszErrorFieldName, int nSize);
MSGAPIFUNCTION PSMsgGetErrorFieldNameLength(
PSMSGHANDLE hContext, int *lpnLength);
MSGAPIFUNCTION PSMsgGetErrorRecordName(PSMSGHANDLE hContext,
char *lpszErrorRecordName,
int nSize);
MSGAPIFUNCTION PSMsgGetErrorRecordNameLength(
PSMSGHANDLE hContext,
int *lpnLength);
MSGAPIFUNCTION PSMsgGetErrorTextLength(PSMSGHANDLE hContext,
int *lpnLength);
MSGAPIFUNCTION PSMsgGetErrorText(PSMSGHANDLE hContext,
char *lpszErrorText,
int nSize);

/* Search Dialog Processing */
MSGAPIFUNCTION PSMsgGetSearchFieldCount(PSMSGHANDLE hContext,
int *lpnCount);
MSGAPIFUNCTION PSMsgGetSearchList(PSMSGHANDLE hContext,
LPPSMSGSEARCHFIELD lpSearchInfo);
MSGAPIFUNCTION PSMsgGetSearchRecord(PSMSGHANDLE hContext,
char *lpszSearchRecordName, int nSize);
MSGAPIFUNCTION PSMsgGetSearchRecordLength(PSMSGHANDLE hContext,
int *lpnLength);
MSGAPIFUNCTION PSMsgProcessSearchDialog(PSMSGHANDLE hContext,
#if defined (__cplusplus)
int nMaxRows = 0);
#else
int nMaxRows);
#endif
MSGAPIFUNCTION PSMsgProcessSearchDialogWithMode(PSMSGHANDLE hContext,
#if defined (__cplusplus)
int nMaxRows = 0,
int nMode = 0);
#else
int nMaxRows,
int nMode);
#endif


/* List Box Processing */
MSGAPIFUNCTION PSMsgFindFirstListBoxField(PSMSGHANDLE hContext);
MSGAPIFUNCTION PSMsgFindFirstListBoxRow(PSMSGHANDLE hContext);
MSGAPIFUNCTION PSMsgFindListBoxField(PSMSGHANDLE hContext,
const char *lpcszFieldName);
MSGAPIFUNCTION PSMsgFindListBoxRow(PSMSGHANDLE hContext,
int nRowIndex);
MSGAPIFUNCTION PSMsgFindNextListBoxField(PSMSGHANDLE hContext);
MSGAPIFUNCTION PSMsgFindNextListBoxRow(PSMSGHANDLE hContext);
MSGAPIFUNCTION PSMsgGetListBoxField(PSMSGHANDLE hContext,
LPPSMSGLISTBOXFIELDINFO lpFieldInfo);
MSGAPIFUNCTION PSMsgGetListBoxFieldCount(PSMSGHANDLE hContext,
int *lpnCount);
MSGAPIFUNCTION PSMsgGetListBoxRow(PSMSGHANDLE hContext,
LPPSMSGLISTBOXFIELDINFO lpRowInfo);
MSGAPIFUNCTION PSMsgGetListBoxRowCount(PSMSGHANDLE hContext,
int *lpnRowCount);

/* Edit Table Processing */
MSGAPIFUNCTION PSMsgFindFirstPromptValueRow(PSMSGHANDLE hContext);
MSGAPIFUNCTION PSMsgFindNextPromptValueRow(PSMSGHANDLE hContext);
MSGAPIFUNCTION PSMsgFindPromptValueRow(PSMSGHANDLE hContext,
int nRowIndex);
MSGAPIFUNCTION PSMsgGetEditTableFieldCount(PSMSGHANDLE hContext,
const char *lpcszRecordName,
int *lpnFieldCount);
MSGAPIFUNCTION PSMsgGetEditTableFieldList(PSMSGHANDLE hContext,
const char *lpcszRecordName,
LPPSMSGSEARCHFIELD lpRecordInfo);
MSGAPIFUNCTION PSMsgGetPromptValueFieldCount(PSMSGHANDLE hContext,
int *lpnFieldCount);
MSGAPIFUNCTION PSMsgGetPromptValueRow(PSMSGHANDLE hContext,
LPPSMSGLISTBOXFIELDINFO lpFieldInfo);
MSGAPIFUNCTION PSMsgGetPromptValueRowCount(PSMSGHANDLE hContext,
int *lpnRowCount);
MSGAPIFUNCTION PSMsgProcessPromptTable(PSMSGHANDLE hContext,
const char *lpcszRecordName,
#if defined (__cplusplus)
int nMaxRows = 0);
#else
int nMaxRows);
#endif

#if defined (__cplusplus)
} // extern "C"
#endif

#endif /* _INC_PSMSGAPI_H */



GeneralRe: PeopleSoft API and C# Pin
Heath Stewart17-Jun-04 17:20
protectorHeath Stewart17-Jun-04 17:20 
GeneralRe: PeopleSoft API and C# Pin
sean_carroll18-Jun-04 3:51
sean_carroll18-Jun-04 3:51 
GeneralRe: PeopleSoft API and C# Pin
Heath Stewart18-Jun-04 4:35
protectorHeath Stewart18-Jun-04 4:35 
GeneralRe: PeopleSoft API and C# Pin
sean_carroll18-Jun-04 4:55
sean_carroll18-Jun-04 4:55 
GeneralRe: PeopleSoft API and C# Pin
Heath Stewart18-Jun-04 5:08
protectorHeath Stewart18-Jun-04 5:08 
GeneralRe: PeopleSoft API and C# Pin
sean_carroll18-Jun-04 5:27
sean_carroll18-Jun-04 5:27 
GeneralRe: PeopleSoft API and C# Pin
Colin Angus Mackay17-Jun-04 22:51
Colin Angus Mackay17-Jun-04 22:51 
GeneralRe: PeopleSoft API and C# Pin
eggie517-Jun-04 23:02
eggie517-Jun-04 23:02 
GeneralWM_LBUTTONDOWN Message Pin
Guinness4Strength17-Jun-04 10:04
Guinness4Strength17-Jun-04 10:04 
GeneralRe: WM_LBUTTONDOWN Message Pin
Heath Stewart17-Jun-04 17:11
protectorHeath Stewart17-Jun-04 17:11 
GeneralRe: WM_LBUTTONDOWN Message Pin
Guinness4Strength18-Jun-04 2:58
Guinness4Strength18-Jun-04 2:58 
GeneralRe: WM_LBUTTONDOWN Message Pin
Heath Stewart18-Jun-04 3:44
protectorHeath Stewart18-Jun-04 3:44 
GeneralContext Menu Help Pin
StephenMcAllister17-Jun-04 9:48
StephenMcAllister17-Jun-04 9:48 
GeneralRe: Context Menu Help Pin
LongRange.Shooter17-Jun-04 10:47
LongRange.Shooter17-Jun-04 10:47 
GeneralRe: Context Menu Help Pin
Heath Stewart17-Jun-04 17:17
protectorHeath Stewart17-Jun-04 17:17 
QuestionVB6 Modules =? in C# ??? Pin
antoine@orchus-tech17-Jun-04 9:31
antoine@orchus-tech17-Jun-04 9:31 
AnswerRe: VB6 Modules =? in C# ??? Pin
Judah Gabriel Himango17-Jun-04 9:43
sponsorJudah Gabriel Himango17-Jun-04 9:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.