ade_prefgetval

Land Desktop Development ARX CPP SDK

Up a level
ade_prefgetval
 
 

Gets an AutoCAD Map option setting.

struct resbuf*

ade_prefgetval(

char* variable);

Returns an option value or NULL.

variable Option name. See the Options tables below.

You must release the resbuf.

The function return value depends on which option you specify. The tables below show option names and return values, organized by option type.

Work Session Options
RestoreLastActiveDwgsOnStartup -1 or NULL.
ActivateDwgsOnAttach -1 or NULL.
DontAddObjectsToSaveSet -1 or NULL.
MarkObjectsForEditingWithoutPrompting -1 or NULL.
LogFileActive -1 or NULL.
LogFileName File name (RTSTR). For example, "ade.log".
LogMessageLevel 0, 1, or 2.
Query Options
QueryFileDirectory. Path (RTSTR). For example, "c:\\data\\qry".
CaseSensitiveMatch. -1 or NULL.
SaveCurrQueryInSession. -1 or NULL.
MkSelSetWithQryObj -1 or NULL.
DefaultJoinOperator 1 = OR, 2 = AND.
ColorForAdd Color (RTSTR).
ColorForRemove Color (RTSTR).
BlockLocnForQuery 1 = insertion point, 2 = bounding box.
TextLocnForQuery 1 = insertion point, 2 = bounding box.
ShowBlockAsInsPt -1 or NULL.
ShowImageAsBoundary -1 or NULL.
CreateAssociativeHatchObjects -1 or NULL.
ReferenceBoundaryForAreaLocation -1 or NULL.
Save Back Options
RedefineBlockDefinitions -1 or NULL.
RedefineLayerDefinitions -1 or NULL.
RedefineTextStyleDefinitions -1 or NULL.
RemoveUnusedGroups -1 or NULL.
EraseSavedBackObjects -1 or NULL.
RemoveLockAfterSave -1 or NULL.
CreateHistoryFileOfChanges -1 or NULL.
CreateBackupFileOfSourceDwg -1 or NULL.
External Database Options
NoOfSQLConditionsInHistory RTSHORT.
DisplayTabsInSingleView -1 or NULL.
OpenDataViewReadOnly -1 or NULL.
SaveDataViewFmtChanges -1 or NULL.
ReconnectDbOnWSOpen -1 or NULL.
ShowFullDBPath -1 or NULL.
KeepDataViewOnTop -1 or NULL.
dbfDatabases RTSTR, one of the following: "Prompt", "DB3", "DB4", "DB5", "FOX2.0", "FOX2.5", or "FOX2.6".
xlsDatabases RTSTR, one of the following: "Prompt", "Excel3", "Excel4", "Excel5", or "Excel7".
dbDatabases RTSTR, one of the following: "Prompt", "Paradox3.0", "Paradox4.0", or "Paradox5.0".
Coordinate Transformation Options
AdjustSizesAndScalesForChangesInUnits -1 or NULL.
AdjustRotationsForMapDistortions -1 or NULL.
AdjustSizesAndScalesForMapDistortions -1 or NULL.
AdjustElevations -1 or NULL.
AdjustZeroRotationObjects -1 or NULL.
.
System Options
AccessWorkCenter -1 or NULL.
CheckoutDirectory Path (RTSTR). For example, "c:\\data\\dwg" or "" if none.
PreserveAWCFiles -1 or NULL.
ForceUserLogin -1 or NULL.
EnableObjectLocking -1 or NULL.
ReadPrefFromINI -1 or NULL.
NumberofOpenDwgs RTSHORT
DoublePrec RTREAL, 0 or greater, but less than 1.

The "ForceUserLogin" and "DoublePrec" system options cannot be modified unless your end user has superuser privileges.

If "DoublePrec" is set to 0, the behavior of data extension queries is the same as before introducing this option. The "DoublePrec" option has no user interface equivalent.

Workspace Options
CheckClasses -1 or NULL.
CheckDrawings -1 or NULL.
CheckQueryLibrary -1 or NULL.
CheckDatabases -1 or NULL.
CheckTables -1 or NULL.
CheckQueries -1 or NULL.
CheckTopologies -1 or NULL.
CheckLPNs -1 or NULL. Note that link path names (LPNs) have been replaced by link templates in AutoCAD Map.
ShowOPMOnStartup -1 or NULL.
ShowWSpaceOnStartup -1 or NULL.
WSpaceDockingView -1 or NULL.
WSpaceWindowRect A list of four values (RTSHORT) that define the left, top, right, and bottom of the window rectangle.

Database tables and database query categories are visible in the workspace only if "CheckTables" and "CheckQueries" are set to T and "CheckDatabases" is set to T also.

The following workspace options are read only. That is, they can be used only with ade_prefgetval to determine if a category is visible in the workspace.

Read-Only Workspace Options
ClassesVisible -1 or NULL.
DrawingsVisible -1 or NULL.
QueryLibraryVisible -1 or NULL.
DatabasesVisible -1 or NULL.
TablesVisible -1 or NULL.
QueriesVisible -1 or NULL.
TopologiesVisible -1 or NULL.
LPNsVisible -1 or NULL.

The following sample parses the resbuf returned by ade_prefgetval() and prints the value for the specified option using a switch case statement. Then it releases the resbuf, as required.

char* pszOptionVar = "LogFileName";
struct resbuf* pGetPrefValRb = ade_prefgetval(pszOptionVar);
if(pGetPrefValRb != NULL){
    struct resbuf* rb = pGetPrefValRb;
    while(rb != NULL) {
        switch(rb->restype)
        {
            case RTT:
                acutPrintf(
                    "\nThe %s option variable contained the value: %d"
                    , pszOptionVar, rb->resval.rint);
                break;
            case RTSHORT:
                acutPrintf(
                    "\nThe %s option variable contained the value: %d"
                    , pszOptionVar, rb->resval.rint);
                break;
            case RTSTR:
                acutPrintf(
                    "\nThe %s option variable contained the value: %s"
                    , pszOptionVar, rb->resval.rstring);
                break;
            default:
                acutPrintf(
                    "\nCould not determine the value");
                break;
        }
        rb = rb->rbnext;
    }
}
else
{
    acutPrintf("\nNo value was assigned to %s."
        , pszOptionVar);
}
acutRelRb(pGetPrefValRb);