badri01
Active Member
Hi List,
I am trying to call a report from a C function using jdeLaunchUBEEx.I have used the codes from Address Book example and B4200310 for creating this function(Whipping Boy's previous posts helped me for doing it).I have done all the compiler settings ,But getting 2 hard errors when Compiling.Please have a look and any help will be really appreciated.
Error is as follows
----------------------------------------------------------------------
--------------------Configuration: TestUBECall - Win32 Debug--------------------
Compiling...
TestUBECall.cpp
C:\badri\JDE Docs\CallUBE\TestUBECall.cpp(67) : error C2440: '=' : cannot convert from 'void *' to 'struct tagUBEVAR *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
C:\badri\JDE Docs\CallUBE\TestUBECall.cpp(80) : error C2227: left of '->szCMComputerID' must point to class/struct/union
Error executing cl.exe.
TestUBECall.obj - 2 error(s), 0 warning(s)
-----------------------------------------------------------------------
-----------------------------------------------------------------------
C Program is as follows
-----------------------------------------------------------------------
#include <jde.h>
// The make file is a standard VC++ 6.0 project for a Win32 Console Application,
// Win32 Dynamic-Link Library, etc.
// The following settings need to be changed:
// define KERNEL (/D "KERNEL")
// add include paths ../include,../includea,../includev
// change byte alignment to 1 byte and change code generation to _stdcall if
// using the JDEError API's.
// link with JDEKRNL.LIB & JDEL.LIB
//
// The command line parameters to the program are:
// -u user -p password -e environment
int _cdecl main()
{
HENV hEnv = NULL;
HUSER hUser = NULL;
HREQUEST hRequest = NULL;
LPJDEERROR_RECORD ErrorRec = NULL;
INT NumErrors = 0;
INT NumWarnings = 0;
ID idResult;
LPCG_BHVR lpVoid = NULL;
LPVOID lpDS = NULL;
LPBHVRCOM lpBhvrCom = NULL;
ERROR_EVENT_KEY EventKeyLocal;
// Initialize Environment Handle
if(JDB_InitEnvOvr(&hEnv,"DEMOB73","DEMO","DEMO")!=JDEDB_PASSED)
{
fprintf(stderr,"JDB_InitEnvOvr failed.\n");
return -1;
}
// Initialize User
if(JDB_InitUser(hEnv, &hUser, NULL,JDEDB_COMMIT_AUTO)!=JDEDB_PASSED)
{
fprintf(stderr,"JDB_InitUser failed\n");
return -1;
}
// Set up the lpBhvrCom amd lpVoid objects
jdeCreateBusinessFunctionParms(hUser, &lpBhvrCom,(LPVOID*) &lpVoid);
lpVoid->lpHdr = jdeErrorInitializeEx();
lpVoid->lpErrorEventKey = (LPERROR_EVENT_KEY) jdeAlloc(COMMON_POOL, sizeof(ERROR_EVENT_KEY), MEM_ZEROINIT | MEM_FIXED);
lpVoid->lpHdr->nCurDisplayed = -1;
lpBhvrCom->lpObj->lpFormHdr = lpVoid->lpHdr;
EventKeyLocal.hwndCtrl = NULL;
EventKeyLocal.iGridCol = 0;
EventKeyLocal.iGridRow = 0;
EventKeyLocal.wEvent = 1;
lpBhvrCom->lpEventKey = (LPVOID)&EventKeyLocal;
//=================================================
/************************************************************************
* Variable and Structure Declarations
************************************************************************/
PUBEVAR pUbeVar = (PUBEVAR)NULL;
/************************************************************************
* Main Processing
************************************************************************/
pUbeVar = jdeAlloc(COMMON_POOL, sizeof(struct tagUBEVAR),MEM_ZEROINIT);
if (pUbeVar != (PUBEVAR)NULL)
{
memset((void *)pUbeVar, (int)'\0', sizeof(pUbeVar));
/*--------------------------------------------------------------------
* Load Ube Structure
*-------------------------------------------------------------------*/
pUbeVar->bPreview = FALSE;
jdeNIDcpy((char *)pUbeVar->szReport,(const char *)"R5607COL");
strcpy((char *)pUbeVar->szVersion, (const char *)"SHA001"); /* CHG 2830649 */
strcpy((char *)pUbeVar->szMachineKey, (const char *)lpDS->szCMComputerID);
GetLocalEnvironmentName(pUbeVar->szEnhv, 11);
pUbeVar->idRunTime = (GLRTID)lpBhvrCom->hDlg << 16;
/*--------------------------------------------------------------------
* Run the UBE Asynchronously
*-------------------------------------------------------------------*/
pUbeVar->bSynchFlag = FALSE;
/*--------------------------------------------------------------------
* Run the UBE in Batch Mode
*-------------------------------------------------------------------*/
pUbeVar->bBatchFlag = TRUE;
/*--------------------------------------------------------------------
* Launch the Ube
*-------------------------------------------------------------------*/
jdeLaunchUBEEx((HUSER)hUser, (PUBEVAR)pUbeVar, (LPVOID)NULL,
lpBhvrCom);
}
//===================================================
// Clean up the lpBhvrCom and lpVoid objects and free the user and environment
jdeErrorClear(lpBhvrCom);
jdeFree(((LPCG_BHVR)lpVoid)->lpErrorEventKey);
jdeErrorTerminateEx(((LPCG_BHVR)lpVoid)->lpHdr);
jdeFreeBusinessFunctionParms(lpBhvrCom,lpVoid);
if(hUser)JDB_FreeUser(hUser);
if(hEnv)JDB_FreeEnv(hEnv);
printf("exit main\n");
return 0;
}
--------------------------------------------------------------------
Thanks in advance
Badri
I am trying to call a report from a C function using jdeLaunchUBEEx.I have used the codes from Address Book example and B4200310 for creating this function(Whipping Boy's previous posts helped me for doing it).I have done all the compiler settings ,But getting 2 hard errors when Compiling.Please have a look and any help will be really appreciated.
Error is as follows
----------------------------------------------------------------------
--------------------Configuration: TestUBECall - Win32 Debug--------------------
Compiling...
TestUBECall.cpp
C:\badri\JDE Docs\CallUBE\TestUBECall.cpp(67) : error C2440: '=' : cannot convert from 'void *' to 'struct tagUBEVAR *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
C:\badri\JDE Docs\CallUBE\TestUBECall.cpp(80) : error C2227: left of '->szCMComputerID' must point to class/struct/union
Error executing cl.exe.
TestUBECall.obj - 2 error(s), 0 warning(s)
-----------------------------------------------------------------------
-----------------------------------------------------------------------
C Program is as follows
-----------------------------------------------------------------------
#include <jde.h>
// The make file is a standard VC++ 6.0 project for a Win32 Console Application,
// Win32 Dynamic-Link Library, etc.
// The following settings need to be changed:
// define KERNEL (/D "KERNEL")
// add include paths ../include,../includea,../includev
// change byte alignment to 1 byte and change code generation to _stdcall if
// using the JDEError API's.
// link with JDEKRNL.LIB & JDEL.LIB
//
// The command line parameters to the program are:
// -u user -p password -e environment
int _cdecl main()
{
HENV hEnv = NULL;
HUSER hUser = NULL;
HREQUEST hRequest = NULL;
LPJDEERROR_RECORD ErrorRec = NULL;
INT NumErrors = 0;
INT NumWarnings = 0;
ID idResult;
LPCG_BHVR lpVoid = NULL;
LPVOID lpDS = NULL;
LPBHVRCOM lpBhvrCom = NULL;
ERROR_EVENT_KEY EventKeyLocal;
// Initialize Environment Handle
if(JDB_InitEnvOvr(&hEnv,"DEMOB73","DEMO","DEMO")!=JDEDB_PASSED)
{
fprintf(stderr,"JDB_InitEnvOvr failed.\n");
return -1;
}
// Initialize User
if(JDB_InitUser(hEnv, &hUser, NULL,JDEDB_COMMIT_AUTO)!=JDEDB_PASSED)
{
fprintf(stderr,"JDB_InitUser failed\n");
return -1;
}
// Set up the lpBhvrCom amd lpVoid objects
jdeCreateBusinessFunctionParms(hUser, &lpBhvrCom,(LPVOID*) &lpVoid);
lpVoid->lpHdr = jdeErrorInitializeEx();
lpVoid->lpErrorEventKey = (LPERROR_EVENT_KEY) jdeAlloc(COMMON_POOL, sizeof(ERROR_EVENT_KEY), MEM_ZEROINIT | MEM_FIXED);
lpVoid->lpHdr->nCurDisplayed = -1;
lpBhvrCom->lpObj->lpFormHdr = lpVoid->lpHdr;
EventKeyLocal.hwndCtrl = NULL;
EventKeyLocal.iGridCol = 0;
EventKeyLocal.iGridRow = 0;
EventKeyLocal.wEvent = 1;
lpBhvrCom->lpEventKey = (LPVOID)&EventKeyLocal;
//=================================================
/************************************************************************
* Variable and Structure Declarations
************************************************************************/
PUBEVAR pUbeVar = (PUBEVAR)NULL;
/************************************************************************
* Main Processing
************************************************************************/
pUbeVar = jdeAlloc(COMMON_POOL, sizeof(struct tagUBEVAR),MEM_ZEROINIT);
if (pUbeVar != (PUBEVAR)NULL)
{
memset((void *)pUbeVar, (int)'\0', sizeof(pUbeVar));
/*--------------------------------------------------------------------
* Load Ube Structure
*-------------------------------------------------------------------*/
pUbeVar->bPreview = FALSE;
jdeNIDcpy((char *)pUbeVar->szReport,(const char *)"R5607COL");
strcpy((char *)pUbeVar->szVersion, (const char *)"SHA001"); /* CHG 2830649 */
strcpy((char *)pUbeVar->szMachineKey, (const char *)lpDS->szCMComputerID);
GetLocalEnvironmentName(pUbeVar->szEnhv, 11);
pUbeVar->idRunTime = (GLRTID)lpBhvrCom->hDlg << 16;
/*--------------------------------------------------------------------
* Run the UBE Asynchronously
*-------------------------------------------------------------------*/
pUbeVar->bSynchFlag = FALSE;
/*--------------------------------------------------------------------
* Run the UBE in Batch Mode
*-------------------------------------------------------------------*/
pUbeVar->bBatchFlag = TRUE;
/*--------------------------------------------------------------------
* Launch the Ube
*-------------------------------------------------------------------*/
jdeLaunchUBEEx((HUSER)hUser, (PUBEVAR)pUbeVar, (LPVOID)NULL,
lpBhvrCom);
}
//===================================================
// Clean up the lpBhvrCom and lpVoid objects and free the user and environment
jdeErrorClear(lpBhvrCom);
jdeFree(((LPCG_BHVR)lpVoid)->lpErrorEventKey);
jdeErrorTerminateEx(((LPCG_BHVR)lpVoid)->lpHdr);
jdeFreeBusinessFunctionParms(lpBhvrCom,lpVoid);
if(hUser)JDB_FreeUser(hUser);
if(hEnv)JDB_FreeEnv(hEnv);
printf("exit main\n");
return 0;
}
--------------------------------------------------------------------
Thanks in advance
Badri