sword _fetchDataIntoLongintArray(ORACLE_SQL_CURSOR *cursor, PA_Variable variable, unsigned int pos) { if(cursor->rowsFetched) { unsigned int itemCount = cursor->rowsFetched < cursor->itemCount ? cursor->rowsFetched : cursor->itemCount; //to clear the content of element #0, if any PA_ResizeArray(&variable, 0); PA_ResizeArray(&variable, itemCount); int intValue; for(unsigned int i = 0; i < itemCount; ++i) { PA_YieldAbsolute(); if(cursor->indicatorLists.at(pos).at(i) != -1) { OCINumberToInt(cursor->errhp, &cursor->arrayOfNumbers.at(pos).at(i), sizeof(int), OCI_NUMBER_SIGNED, &intValue); PA_SetLongintInArray(variable, i + 1, intValue); }else{ setLongintArrayValueNull(variable, i + 1); } } PA_SetPointerValue(&cursor->pointers.at(pos), variable); } return cursor->rowsFetched; }
void ARRAY_LONGINT::toParamAtIndex(PackagePtr pParams, uint32_t index) { if(index) { PA_Variable arr = *((PA_Variable*) pParams[index - 1]); PA_Variable *param = ((PA_Variable *)pParams[index - 1]); switch (arr.fType) { case eVK_ArrayLongint: break; case eVK_Undefined: PA_ClearVariable(&arr); arr = PA_CreateVariable(eVK_ArrayLongint); param->fType = arr.fType; break; default: break; } if(arr.fType == eVK_ArrayLongint) { PA_ResizeArray(&arr, this->_CIntArray->empty() ? 0 : (uint32_t)(this->_CIntArray->size() - 1)); uint32_t i; for(i = 0; i < this->_CIntArray->size(); i++) { PA_SetLongintInArray(arr, i, this->_CIntArray->at(i)); } param->fFiller = 0; param->uValue.fArray.fCurrent = arr.uValue.fArray.fCurrent; param->uValue.fArray.fNbElements = arr.uValue.fArray.fNbElements; param->uValue.fArray.fData = arr.uValue.fArray.fData; } } }
void processWindowMessage(LONG_PTR source, LONG_PTR hwnd, WPARAM wParam, LPARAM lParam) { char procVar[30] = ST_TRAYNOTIFICATION; LONG_PTR procNbr = 0; PA_Variable fourDVar; BOOL bFuncReturn; bFuncReturn = SetForegroundWindow(windowHandles.fourDhWnd); switch (source) { case TRAY_ICON_FUNCTION : if( ( PA_Get4DVersion() & 0x0000FFFF ) < 0x00001100 ) { // REB #17503 8/8/08 in v11 we can no longer call PA_GetVariable from this subclass. // Instead of setting the ST_TRAYNOTIFICATION variable, we will just do a call // back to the monitoring process in 4D on double clicks. strcpy(procVar, ST_TRAYNOTIFICATION); fourDVar = PA_GetVariable(procVar); if (PA_GetVariableKind(fourDVar) == eVK_Longint) { PA_SetLongintVariable(&fourDVar, lParam); PA_SetVariable(procVar, fourDVar, 1); findIconID( &startPtr, (LONG_PTR)wParam, &procNbr); // find icon id and get process number PA_UpdateProcessVariable(procNbr); } } else { if((lParam==515)|(lParam==518)) { findIconID( &startPtr, (LONG_PTR)wParam, &procNbr); // find icon id and get process number PA_UpdateProcessVariable(procNbr); }; }; break; case RESPECT_TOOL_BAR_FUNCTION : // REB #16207 1/7/09 In v11 we can no longer call PA_GetVariable from this subclass. // Unfortunately we won't be able to support use of <>TB_NOTIFICATION anymore. if( ( PA_Get4DVersion() & 0x0000FFFF ) < 0x00001100 ) { strcpy(procVar, TB_NOTIFICATION); fourDVar = PA_GetVariable(procVar); if (PA_GetVariableKind(fourDVar) == eVK_ArrayLongint) { if (PA_GetArrayNbElements(fourDVar) == 4) { if (toolBarRestrictions.leftProcessNbr > 0) { PA_SetLongintInArray(fourDVar, 1, hwnd); PA_SetVariable(procVar, fourDVar, 0); PA_UpdateProcessVariable(toolBarRestrictions.leftProcessNbr); } if (toolBarRestrictions.topProcessNbr > 0) { PA_SetLongintInArray(fourDVar, 2, hwnd); PA_SetVariable(procVar, fourDVar, 0); PA_UpdateProcessVariable(toolBarRestrictions.topProcessNbr); } if (toolBarRestrictions.rightProcessNbr > 0) { PA_SetLongintInArray(fourDVar, 3, hwnd); PA_SetVariable(procVar, fourDVar, 0); PA_UpdateProcessVariable(toolBarRestrictions.rightProcessNbr); } if (toolBarRestrictions.bottomProcessNbr > 0) { PA_SetLongintInArray(fourDVar, 4, hwnd); PA_SetVariable(procVar, fourDVar, 0); PA_UpdateProcessVariable(toolBarRestrictions.bottomProcessNbr); } } } } else { // REB 3/29/10 #22878 Since we can't update the TB_NOTIFICATION array, just do a call to the toolbar processes. if (toolBarRestrictions.leftProcessNbr > 0) { PA_UpdateProcessVariable(toolBarRestrictions.leftProcessNbr); } if (toolBarRestrictions.topProcessNbr > 0) { PA_UpdateProcessVariable(toolBarRestrictions.topProcessNbr); } if (toolBarRestrictions.rightProcessNbr > 0) { PA_UpdateProcessVariable(toolBarRestrictions.rightProcessNbr); } if (toolBarRestrictions.bottomProcessNbr > 0) { PA_UpdateProcessVariable(toolBarRestrictions.bottomProcessNbr); } } break; } }
// ------------------------------------------------ // // FUNCTION: gui_SelectColor( PA_PluginParameters params) // // PURPOSE: Displays the color common dialog // // COMMENTS: // // // DATE: dcc 11/25/02 (3.5.3) // // MODIFICATIONS: // void gui_SelectColor( PA_PluginParameters params) { CHOOSECOLOR cColor; static COLORREF acrCustColor[16]; static DWORD rgbCurrent; LONG_PTR rParam, gParam, bParam, returnValue = 0, i, hasCustom; PA_Variable custColorArray; rParam = PA_GetLongParameter( params, 1); gParam = PA_GetLongParameter( params, 2); bParam = PA_GetLongParameter( params, 3); hasCustom = PA_GetLongParameter( params, 4); if (rParam > 255) rParam = 0; if (gParam > 255) gParam = 0; if (bParam > 255) bParam = 0; if (hasCustom == 1) { custColorArray = PA_GetVariableParameter( params, 5 ); if(PA_GetVariableKind(custColorArray) == eVK_ArrayLongint) { for (i = 0; i < PA_GetArrayNbElements(custColorArray); i++) { acrCustColor[i] = PA_GetLongintInArray(custColorArray, i + 1); } } } ZeroMemory(&cColor, sizeof(CHOOSECOLOR)); cColor.lStructSize = sizeof(CHOOSECOLOR); cColor.hwndOwner = windowHandles.fourDhWnd; cColor.lpCustColors = (LPDWORD) acrCustColor; cColor.rgbResult = rgbCurrent; if ((rParam > 0) || (gParam > 0) || (bParam > 0)) { cColor.rgbResult = RGB(rParam, gParam, bParam); cColor.Flags = CC_FULLOPEN | CC_RGBINIT; } else { cColor.Flags = CC_FULLOPEN; } if (ChooseColor(&cColor)== TRUE) { rgbCurrent = cColor.rgbResult; rParam = GetRValue(rgbCurrent); gParam = GetGValue(rgbCurrent); bParam = GetBValue(rgbCurrent); PA_SetLongParameter( params, 1, rParam ); PA_SetLongParameter( params, 2, gParam ); PA_SetLongParameter( params, 3, bParam ); if (hasCustom == 1) { PA_ResizeArray(&custColorArray, 16); for (i = 0; i < 16; i++) { PA_SetLongintInArray(custColorArray, i + 1, acrCustColor[i]); } PA_SetVariableParameter( params, 5, custColorArray, 0); } returnValue = 1; } PA_ReturnLong( params, returnValue); }
void sys_EnumProcesses( PA_PluginParameters params ) { HANDLE hProcessSnap; // Handle to the process snapshot PROCESSENTRY32 pe32; // ProcessEntry to get info about processes PA_Variable paNameArray; // Array to store process names ($1) PA_Variable paIDArray; // Array to store process IDs ($2) INT_PTR iSize = 0; // Int to control size of array // Get variables representing passed in arrays paNameArray = PA_GetVariableParameter(params, 1); paIDArray = PA_GetVariableParameter(params, 2); // Resize arrays to 0 PA_ResizeArray(&paNameArray, iSize); PA_ResizeArray(&paIDArray, iSize); // Take a snapshot of all processes in the system. // If we fail, return the error code hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if(hProcessSnap == INVALID_HANDLE_VALUE) { PA_ReturnLong(params, (LONG_PTR)GetLastError()); return; } // Set the size of the structure before using it. pe32.dwSize = sizeof( PROCESSENTRY32 ); // Retrieve information about the first process, // If we can't do it, then return the error code if(!Process32First( hProcessSnap, &pe32)) { CloseHandle( hProcessSnap ); // Must clean up the snapshot object! PA_ReturnLong(params, (LONG_PTR)GetLastError()); return; } // Now walk the snapshot of processes, and // Insert an array element in each array, one for name and one for ID. do { iSize++; PA_ResizeArray(&paNameArray, iSize); PA_ResizeArray(&paIDArray, iSize); PA_SetTextInArray(paNameArray, iSize, pe32.szExeFile, strlen(pe32.szExeFile)); PA_SetLongintInArray(paIDArray, iSize, pe32.th32ProcessID); } while(Process32Next(hProcessSnap, &pe32)); // Close the handle and return success CloseHandle(hProcessSnap); // Set return arrays PA_SetVariableParameter(params, 1, paNameArray, 0); PA_SetVariableParameter(params, 2, paIDArray, 0); // Return error code. PA_ReturnLong(params, 0); }