void OD_INTROSPECT_CURSOR(sLONG_PTR *pResult, PackagePtr pParams)
{
	C_LONGINT Param1;
	C_TEXT Param2;
	ARRAY_TEXT Param3;
	ARRAY_TEXT Param4;
	ARRAY_TEXT Param5;
	ARRAY_TEXT Param6;
	
	Param1.fromParamAtIndex(pParams, 1);
	
	ORACLE_SQL_CURSOR *cursor = _cursorGet(Param1.getIntValue());
	
	if(cursor)
	{
		Param2.setUTF16String(&cursor->sql);
		Param3.setSize(1);
		Param4.setSize(1);
		Param5.setSize(1);
		Param6.setSize(1);
		
		uint32_t i;
		PA_Unistring u;
		CUTF8String stringValue;
		
		for(i = 0; i < cursor->substitutions.size(); i++)
		{
			PA_Variable variable = cursor->substitutions.at(i);
			
			CUTF16String name = cursor->names.at(i);
			Param6.appendUTF16String(&name);
			
			switch (PA_GetVariableKind(variable))
			{	
				case eVK_PointerToField:
					Param3.appendUTF8String(&VARIABLE_TYPE_FIELD);
					_toFieldString(variable, stringValue);
					Param4.appendUTF8String(&stringValue);
					break;					
					
				case eVK_Integer:						
				case eVK_Longint:
					Param3.appendUTF8String(&VARIABLE_TYPE_LONGINT);
					_toLongintString(variable, stringValue);
					Param4.appendUTF8String(&stringValue);
					break;
					
				case eVK_Real:
					Param3.appendUTF8String(&VARIABLE_TYPE_REAL);
					_toRealString(variable, stringValue);
					Param4.appendUTF8String(&stringValue);				
					break;					
					
				case eVK_Unistring:
					Param3.appendUTF8String(&VARIABLE_TYPE_TEXT);
					u = PA_GetStringVariable(variable);
					Param4.appendUTF16String(&u);				
					break;
					
				case eVK_Boolean:
					Param3.appendUTF8String(&VARIABLE_TYPE_BOOLEAN);
					_toBooleanString(variable, stringValue);
					Param4.appendUTF8String(&stringValue);					
					break;	
					
				case eVK_Date:
					Param3.appendUTF8String(&VARIABLE_TYPE_DATE);					
					_toDateString(variable, stringValue);
					Param4.appendUTF8String(&stringValue);					
					break;	
					
				case eVK_Time:
					Param3.appendUTF8String(&VARIABLE_TYPE_TIME);					
					_toTimeString(variable, stringValue);
					Param4.appendUTF8String(&stringValue);
					break;
					
				case eVK_Picture:
					Param3.appendUTF8String(&VARIABLE_TYPE_PICTURE);	
					_toPictureString(variable, stringValue);
					Param4.appendUTF8String(&stringValue);
					break;
					
				case eVK_Blob:	
					Param3.appendUTF8String(&VARIABLE_TYPE_BLOB);	
					_toBlobString(variable, stringValue);
					Param4.appendUTF8String(&stringValue);					
					break;
					
				case eVK_ArrayUnicode:	
					Param3.appendUTF8String(&VARIABLE_TYPE_ARRAY_TEXT);	
					_toArrayString(variable, stringValue);
					Param4.appendUTF8String(&stringValue);					
					break;
					
				case eVK_ArrayBoolean:	
					Param3.appendUTF8String(&VARIABLE_TYPE_ARRAY_BOOLEAN);	
					_toArrayString(variable, stringValue);
					Param4.appendUTF8String(&stringValue);					
					break;					
					
				case eVK_ArrayPicture:	
					Param3.appendUTF8String(&VARIABLE_TYPE_ARRAY_PICTURE);	
					_toArrayString(variable, stringValue);
					Param4.appendUTF8String(&stringValue);					
					break;						
					
				case eVK_ArrayDate:	
					Param3.appendUTF8String(&VARIABLE_TYPE_ARRAY_DATE);	
					_toArrayString(variable, stringValue);
					Param4.appendUTF8String(&stringValue);					
					break;							
					
				case eVK_ArrayLongint:	
				case eVK_ArrayInteger:						
					Param3.appendUTF8String(&VARIABLE_TYPE_ARRAY_LONGINT);	
					_toArrayString(variable, stringValue);
					Param4.appendUTF8String(&stringValue);					
					break;							
					
				case eVK_ArrayReal:						
					Param3.appendUTF8String(&VARIABLE_TYPE_ARRAY_REAL);	
					_toArrayString(variable, stringValue);
					Param4.appendUTF8String(&stringValue);					
					break;	
					
				default:	
					Param3.appendUTF8String(&VARIABLE_TYPE_ERROR);	
					Param4.appendUTF8String(&VARIABLE_VALUE_NULL);	
					break;	
					
			}
			
			if(cursor->isTowardsSQL.at(i))
			{
				Param5.appendUTF8String(&BIND_TOWARDS_SQL);						
			}else{
				Param5.appendUTF8String(&BIND_TOWARDS_4D);
			}
			
		}		
		
	}
	
	Param2.toParamAtIndex(pParams, 2);
	Param3.toParamAtIndex(pParams, 3);
	Param4.toParamAtIndex(pParams, 4);
	Param5.toParamAtIndex(pParams, 5);	
	Param6.toParamAtIndex(pParams, 6);		
}
示例#2
0
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;

    }
}
void OD_Load_rows_cursor(sLONG_PTR *pResult, PackagePtr pParams)
{
	C_LONGINT Param1;
	C_LONGINT returnValue;
	
	Param1.fromParamAtIndex(pParams, 1);
	
	uint32_t cursorId = Param1.getIntValue();
	
	sword err = 0;
	
	ORACLE_SQL_CURSOR *cursor = _cursorGetAndCheckActive(cursorId);
	
	if(cursor)
	{
		
		sessionInfo *session = _sessionGet(cursor->sessionId);
	
		if(session)
		{

			PA_FieldKind kind;
			short stringLength;
			char indexed;
			long attributes;
			
			if(!cursor->isEndOfSelection)
			{
				err = _checkNumberOfRecordsToFetch(cursor);
			
				if(err != -1)
				{
					
					for(unsigned int i = 0; i < cursor->substitutions.size(); ++i)
					{
						
						if(!cursor->isTowardsSQL.at(i))
						{
							switch (PA_GetVariableKind(cursor->substitutions.at(i)))
							{
								case eVK_ArrayUnicode:
									err = _fetchDataIntoTextArray(cursor, cursor->substitutions.at(i), i, session);
									break;
									
								case eVK_ArrayLongint:
									err = _fetchDataIntoLongintArray(cursor, cursor->substitutions.at(i), i);
									break;
									
								case eVK_ArrayBoolean:
									err = _fetchDataIntoBooleanArray(cursor, cursor->substitutions.at(i), i);
									break;
									
								case eVK_ArrayReal:
									err = _fetchDataIntoRealArray(cursor, cursor->substitutions.at(i), i);
									break;
									
								case eVK_ArrayDate:
									err = _fetchDataIntoDateArray(cursor, cursor->substitutions.at(i), i);
									break;
									
								case eVK_Unistring:
									err = _fetchDataIntoTextVariable(cursor, cursor->substitutions.at(i), i, session);
									break;							
									
								case eVK_Longint:
									err = _fetchDataIntoLongintVariable(cursor, cursor->substitutions.at(i), i);
									break;		
									
								case eVK_Boolean:
									err = _fetchDataIntoBooleanVariable(cursor, cursor->substitutions.at(i), i);
									break;		
									
								case eVK_Real:
									err = _fetchDataIntoRealVariable(cursor, cursor->substitutions.at(i), i);
									break;	
									
								case eVK_Date:
									err = _fetchDataIntoDateVariable(cursor, cursor->substitutions.at(i), i);
									break;	
									
								case eVK_Time:
									err = _fetchDataIntoTimeVariable(cursor, cursor->substitutions.at(i), i);
									break;	

								case eVK_Blob:
									err = _fetchDataIntoBlobVariable(cursor, cursor->substitutions.at(i), i, session);
									break;										

								case eVK_PointerToField:							
									PA_GetFieldProperties(cursor->substitutions.at(i).uValue.fTableFieldDefinition.fTableNumber, 
														  cursor->substitutions.at(i).uValue.fTableFieldDefinition.fFieldNumber, 
														  &kind, 
														  &stringLength, 
														  &indexed, 
														  &attributes);
									
									if(eER_NoErr == PA_GetLastError())
									{
										unsigned int recordsInSelection = PA_RecordsInSelection(cursor->substitutions.at(i).uValue.fTableFieldDefinition.fTableNumber);
										
										switch (recordsInSelection)
										{
											case 0:
												break;
												
											case 1:
												switch(kind)
											{
												case eFK_AlphaField:
													err = _fetchDataIntoAlphaField(cursor, cursor->substitutions.at(i), i, session);
													break;
													
												case eFK_TextField:
													err = _fetchDataIntoTextField(cursor, cursor->substitutions.at(i), i, session);
													break;		
													
												case eFK_LongintField:
													err = _fetchDataIntoLongintField(cursor, cursor->substitutions.at(i), i);
													break;	
													
												case eFK_IntegerField:
													err = _fetchDataIntoIntegerField(cursor, cursor->substitutions.at(i), i);
													break;	
													
												case eFK_BooleanField:
													err = _fetchDataIntoBooleanField(cursor, cursor->substitutions.at(i), i);
													break;			
													
												case eFK_RealField:
													err = _fetchDataIntoRealField(cursor, cursor->substitutions.at(i), i);
													break;		
													
												case eFK_DateField:
													err = _fetchDataIntoDateField(cursor, cursor->substitutions.at(i), i);
													break;		
													
												case eFK_TimeField:
													err = _fetchDataIntoTimeField(cursor, cursor->substitutions.at(i), i);
													break;	
													
												case eFK_BlobField:
													err = _fetchDataIntoBlobField(cursor, cursor->substitutions.at(i), i, session);
													break;	
													
												default:
													break;
													
											}
												
										}
										
									}
									break;
									
								default:
									break;							
							}
							
						}
						
					}
					
				}
			
				if(cursor->isEndOfSelectionInFirstCall)
					cursor->isEndOfSelection = true;
				
			}
			
			returnValue.setIntValue(err);

		}
			
	}
	
	returnValue.setReturn(pResult);
}
void OD_EXECUTE_CURSOR(sLONG_PTR *pResult, PackagePtr pParams)
{
	C_LONGINT Param1;
	C_LONGINT Param2;	
	
	Param1.fromParamAtIndex(pParams, 1);
	Param2.fromParamAtIndex(pParams, 2);
	
	uint32_t cursorId = Param1.getIntValue();
	uint32_t itemCount = Param2.getIntValue();
	
	if(!itemCount)
		itemCount = 20;//default value in old plugin

	ORACLE_SQL_CURSOR *cursor = _cursorGetAndCheckInactive(cursorId);
	
	if(cursor)
	{		
		sessionInfo *session = _sessionGet(cursor->sessionId);
		
		if(session)
		{
			sword status = 0;
			
			PA_FieldKind kind;
			short stringLength;
			char indexed;
			long attributes;
			
			cursor->itemCount = itemCount;
			
			for(unsigned int i = 0; i < cursor->substitutions.size(); ++i)
			{				
				if(cursor->isTowardsSQL.at(i))
				{
					switch (PA_GetVariableKind(cursor->substitutions.at(i)))
					{
						case eVK_ArrayUnicode:							
							_bindTextArrayTowardsSQL(cursor, cursor->substitutions.at(i), i);
							break;	
							
						case eVK_ArrayLongint:							
							_bindLongintArrayTowardsSQL(cursor, cursor->substitutions.at(i), i);
							break;
							
						case eVK_ArrayBoolean:							
							_bindBooleanArrayTowardsSQL(cursor, cursor->substitutions.at(i), i);
							break;	
							
						case eVK_ArrayReal:							
							_bindRealArrayTowardsSQL(cursor, cursor->substitutions.at(i), i);
							break;	
							
						case eVK_ArrayDate:							
							_bindDateArrayTowardsSQL(cursor, cursor->substitutions.at(i), i);
							break;		
							
						case eVK_Unistring:
							_bindTextVariableTowardsSQL(cursor, cursor->substitutions.at(i), i);
							break;
							
						case eVK_Longint:							
							_bindLongintVariableTowardsSQL(cursor, cursor->substitutions.at(i), i);
							break;	
							
						case eVK_Boolean:
							_bindBooleanVariableTowardsSQL(cursor, cursor->substitutions.at(i), i);
							break;	
	
						case eVK_Real:							
							_bindRealVariableTowardsSQL(cursor, cursor->substitutions.at(i), i);
							break;	

						case eVK_Date:							
							_bindDateVariableTowardsSQL(cursor, cursor->substitutions.at(i), i);
							break;
							
						case eVK_Time:							
							_bindTimeVariableTowardsSQL(cursor, cursor->substitutions.at(i), i);
							break;
							
						case eVK_Blob:							
							_bindBlobVariableTowardsSQL(cursor, cursor->substitutions.at(i), i);
							break;
							
						case eVK_PointerToField:							
							PA_GetFieldProperties(cursor->substitutions.at(i).uValue.fTableFieldDefinition.fTableNumber, 
												  cursor->substitutions.at(i).uValue.fTableFieldDefinition.fFieldNumber, 
												  &kind, 
												  &stringLength, 
												  &indexed, 
												  &attributes);
							
							if(eER_NoErr == PA_GetLastError())
							{
								unsigned int recordsInSelection = PA_RecordsInSelection(cursor->substitutions.at(i).uValue.fTableFieldDefinition.fTableNumber);
	
								switch (recordsInSelection)
								{
									case 0:
										break;
										
									case 1:
										switch(kind)
										{
											case eFK_AlphaField:
												_bindAlphaFieldTowardsSQL(cursor, cursor->substitutions.at(i), i);
												break;
												
											case eFK_TextField:
												_bindTextFieldTowardsSQL(cursor, cursor->substitutions.at(i), i);
												break;
												
											case eFK_LongintField:
												_bindLongintFieldTowardsSQL(cursor, cursor->substitutions.at(i), i);
												break;	

											case eFK_IntegerField:
												_bindIntegerFieldTowardsSQL(cursor, cursor->substitutions.at(i), i);
												break;	
												
											case eFK_BooleanField:
												_bindBooleanFieldTowardsSQL(cursor, cursor->substitutions.at(i), i);
												break;	
												
											case eFK_RealField:
												_bindRealFieldTowardsSQL(cursor, cursor->substitutions.at(i), i);
												break;	
												
											case eFK_DateField:
												_bindDateFieldTowardsSQL(cursor, cursor->substitutions.at(i), i);
												break;		
												
											case eFK_TimeField:
												_bindTimeFieldTowardsSQL(cursor, cursor->substitutions.at(i), i);
												break;	
												
											case eFK_BlobField:
												_bindBlobFieldTowardsSQL(cursor, cursor->substitutions.at(i), i);
												break;	
												
											default:
												break;
										}
										break;
									
									default:
										break;
								}
							}							
							break;	
							
						default:
							break;
					}
					   
				}else{
				   
				   switch (PA_GetVariableKind(cursor->substitutions.at(i)))
				   {
						   
					   case eVK_ArrayUnicode:
						   _bindTextArrayTowards4D(cursor, i);
						   break;
						
					   case eVK_ArrayLongint:
						   _bindLongintArrayTowards4D(cursor, i);
						   break;

					   case eVK_ArrayBoolean:
						   _bindBooleanArrayTowards4D(cursor, i);
						   break;
						   
					   case eVK_ArrayReal:
						   _bindRealArrayTowards4D(cursor, i);
						   break;		
						   
					   case eVK_ArrayDate:
						   _bindDateArrayTowards4D(cursor, i);
						   break;
						   
					   case eVK_Unistring:
						   _bindTextVariableTowards4D(cursor, i);
						   break;		
						   
					   case eVK_Longint:
						   _bindLongintVariableTowards4D(cursor, i);
						   break;		
						   
					   case eVK_Boolean:
						   _bindBooleanVariableTowards4D(cursor, i);
						   break;	
						   
					   case eVK_Real:
						   _bindRealVariableTowards4D(cursor, i);
						   break;	

					   case eVK_Date:
						   _bindDateVariableTowards4D(cursor, i);
						   break;
						   
					   case eVK_Time:
						   _bindTimeVariableTowards4D(cursor, i);
						   break;	
						   
					   case eVK_Blob:							
						   _bindBlobVariableTowards4D(cursor, i);
						   break;
   
					   case eVK_PointerToField:							
						   PA_GetFieldProperties(cursor->substitutions.at(i).uValue.fTableFieldDefinition.fTableNumber, 
												 cursor->substitutions.at(i).uValue.fTableFieldDefinition.fFieldNumber, 
												 &kind, 
												 &stringLength, 
												 &indexed, 
												 &attributes);
						   
						   if(eER_NoErr == PA_GetLastError())
						   {
							   unsigned int recordsInSelection = PA_RecordsInSelection(cursor->substitutions.at(i).uValue.fTableFieldDefinition.fTableNumber);
							   
							   switch (recordsInSelection)
							   {
								   case 0:
									   break;
									   
								   case 1:
									   switch(kind)
								   {
									   case eFK_AlphaField:
										   _bindAlphaFieldTowards4D(cursor, i);
										   break;
										   
									   case eFK_TextField:
										   _bindTextFieldTowards4D(cursor, i);
										   break;	
										   
									   case eFK_LongintField:
										   _bindLongintFieldTowards4D(cursor, i);
										   break;			
										   
									   case eFK_IntegerField:
										   _bindIntegerFieldTowards4D(cursor, i);
										   break;	
										   
									   case eFK_BooleanField:
										   _bindBooleanFieldTowards4D(cursor, i);
										   break;	
										   
									   case eFK_RealField:
										   _bindRealFieldTowards4D(cursor, i);
										   break;	

									   case eFK_DateField:
										   _bindDateFieldTowards4D(cursor, i);
										   break;		
										   
									   case eFK_TimeField:
										   _bindTimeFieldTowards4D(cursor, i);
										   break;
										   
									   default:
										   break;   
								   }
								   
								   default:
									   break;   
							   }
							   
						   }
						   break;						   
						   
					   default:
						   break;
				   }
								   
				   //todo
				   //If a statement with RETURNING clause is used, a call to OCIBindDynamic() must follow this call.
			   }

			}

			status = OCIStmtExecute(session->svchp, cursor->stmtp, cursor->errhp, cursor->itemCount, 0, 0, 0, OCI_DEFAULT);
			//http://docs.oracle.com/cd/B10500_01/appdev.920/a96584/oci16ms2.htm
			
			switch (status)
			{
				case OCI_NO_DATA:
				case OCI_SUCCESS:
				case OCI_SUCCESS_WITH_INFO:	
					switch (cursor->sql_type)
					{
					case OCI_STMT_SELECT:
						//we only want to increment the counter after a call to load cursor
						break;
					default:
						OCIAttrGet(cursor->stmtp, OCI_HTYPE_STMT, &cursor->rowCount, 0, OCI_ATTR_ROW_COUNT, cursor->errhp);
						break;
					}
					cursor->isActive = true;
					cursor->isEndOfSelectionInFirstCall = (status == OCI_NO_DATA);
					break;
					
				default:
					_errorInfoSet(session->envhp, cursor->errhp, cursor->sessionId, cursorId, false, PA_GetCurrentProcessNumber(), 0);					
					break;
			}
			//clear any pointer blocks created using PA_ClearVariable
			for(unsigned int i = 0; i < cursor->substitutions.size(); ++i)
			{				
				if(cursor->isTowardsSQL.at(i))
				{
					if(PA_GetVariableKind(cursor->substitutions.at(i)) != eVK_PointerToField) 
						PA_ClearVariable(&cursor->substitutions.at(i));
				}
			}
		
		}
					
	}
	
}
示例#5
0
// ------------------------------------------------
// 
//  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);

}