void M_CWMenuFolder::wpclsInitData() { somId mySomId; CLASSINFO ci; /* call parent */ if((mySomId=somIdFromString("wpclsInitData"))!=NULLHANDLE) { ((somTD_M_WPObject_wpclsInitData) somParentNumResolve(__ClassObject->somGetPClsMtabs(), 1, __ClassObject-> somGetMethodToken(mySomId)) )(this); SOMFree(mySomId); } else M_WPFolder::wpclsInitData(); if(!fInitDone) { /* Get install dir */ queryInstallDir(chrInstallPath, sizeof(chrInstallPath)); /* INI file path */ queryIniFilePath(chrWPSWizIni, sizeof(chrWPSWizIni)); /* Register new button class */ if(WinQueryClassInfo(WinQueryAnchorBlock(HWND_DESKTOP), (PSZ) WC_BUTTON, &ci)) { g_ulButtonDataOffset=ci.cbWindowData; g_pfnwpOrgButtonProc=ci.pfnWindowProc; ulQWP_WIZBUTTONDATA=g_ulButtonDataOffset; if (WinRegisterClass(WinQueryAnchorBlock(HWND_DESKTOP), (PSZ) WC_WIZBUTTON, fnwpWizButtonProc, // ci.pfnWindowProc, ci.flClassStyle&~CS_PUBLIC, ci.cbWindowData + WIZBUTTON_DATASIZE)) { /* */ } } if(WinQueryClassInfo(WinQueryAnchorBlock(HWND_DESKTOP), WC_STATIC, &ci)) { g_haveFlyOverClient=TRUE; /* Blended flyover window is only available if CWFolder is installed. */ } /* Register percentbar class */ if(!percentRegisterBarClass()) SysWriteToTrapLog("Can't register percent bar window class.\n"); /* Register REXX functions */ RexxRegisterFunctionExe("WPSWizCallWPSFunc", (PFN)rxCallWPSFunc); RexxRegisterFunctionExe("WPSWizCallWinFunc", (PFN)rxCallPMFunc); RexxRegisterFunctionExe("WPSWizCallFunc", (PFN)rxCallCWWPSFunc); RexxRegisterFunctionExe("WPSWizCallWPSClsFunc", (PFN)rxCallWPSClassFunc); RexxRegisterFunctionExe("DevGetHash", (PFN)rxGetHash); /* Register the gadget REXX function */ RexxRegisterFunctionExe("WPSWizGadgetFunc", (PFN)rxCallCWWPSFunc); RexxRegisterExitExe("WIZREXX", (PFN)cwRexxExitHandler, NULLHANDLE); /* Load Rexx error dialog */ if(!g_hwndRexxError) { somTD_M_CWObject_wizclsSetRexxErrorWindowHWND methodPtr; g_hwndRexxError=WinLoadDlg(HWND_DESKTOP, HWND_DESKTOP, pfnwpRexxErrorProc, queryModuleHandle(), IDDLG_REXXERROR, NULLHANDLE); TRY_LOUD(ERROR_HWND) { /* Make sure M_CWObject class is installed and replaces the normal M_WPObject class. If yes, the M_CWMenuFolder class has a new static method "wizclsSetRexxErrorWindowHWND". */ methodPtr=(somTD_M_CWObject_wizclsSetRexxErrorWindowHWND) somResolveByName( this, "wizclsSetRexxErrorWindowHWND"); // SysWriteToTrapLog("%s: %x\n", __FUNCTION__, methodPtr); if(methodPtr) methodPtr(this, g_hwndRexxError); } CATCH(ERROR_HWND) { SysWriteToTrapLog("%s: Error while setting REXX error window HWND.\n", __FUNCTION__); } END_CATCH; }
// // MAIN program // int __cdecl main(int argc, char *argv[]) { RXSYSEXIT exit_list[9]; /* Exit list array */ short rexxrc = 0; /* return code from rexx */ int rc; /* actually running program RC */ CONSTRXSTRING argument; /* rexxstart argument */ RXSTRING rxretbuf; // program return buffer rc = 0; /* set default return */ /* just one argument is accepted by this program */ if ((argc < 2) || (argc > 3)) { printf("Wrong arguments: REXXEXIT program [argument]\n"); exit(-1); } /* * Convert the input array into a single string for the Object REXX * argument string. Initialize the RXSTRING variable to point to this * string. Keep the string null terminated so we can print it for debug. * First argument is name of the REXX program * Next argument(s) are parameters to be passed */ /* By setting the strlength of the output RXSTRING to zero, we */ /* force the interpreter to allocate memory and return it to us. */ /* We could provide a buffer for the interpreter to use instead. */ rxretbuf.strlength = 0L; /* initialize return to empty*/ if (argc == 3) { MAKERXSTRING(argument, argv[2], strlen(argv[2]));/* create input argument */ } else MAKERXSTRING(argument, "", 0);/* create blank argument */ // register IO exit rc = RexxRegisterExitExe("MY_IOC", (REXXPFN)&MY_IOEXIT, NULL); /* run this via RexxStart */ exit_list[0].sysexit_name = "MY_IOC"; exit_list[0].sysexit_code = RXSIO; exit_list[1].sysexit_code = RXENDLST; /* Here we call the interpreter. */ rc=REXXSTART(1, /* number of arguments */ &argument, /* array of arguments */ argv[1], /* name of REXX file */ NULL, /* No INSTORE used */ "CMD", /* Command env. name */ RXCOMMAND, /* Code for how invoked */ exit_list, /* exits for this call */ &rexxrc, /* Rexx program output */ &rxretbuf ); /* Rexx program output */ /* free memory allocated for the return result */ if (rc==0) { RexxFreeMemory(rxretbuf.strptr); } RexxDeregisterExit("MY_IOC",NULL); // remove the exit in exe exit list // return interpeter or rexx program return code return rc ? rc : rexxrc; }