2.2.4.32.32 OriginObject::GetUID

Description

Gets internal Unique IDentification number of Origin object

Syntax

UINT GetUID( BOOL bCreate = FALSE, string * pStrGUID = NULL )

Parameters

bCreate
create ID if it was not created yet
pStrGUID
[output]optional global identification

Return

0 if ID for object was not created. Object unique ID otherwise

Examples

EX1

void OriginObject_GetUID_Ex1()
{
	Worksheet wks = Project.ActiveLayer();

	// Example requires active workbook with column.
	if( !wks || wks.Columns.Count() < 1 )
		return;

	// Get the worksheet and column UIDs.
	UINT uWksID = wks.GetUID(TRUE);
	UINT uColID = wks.Columns.Item(0).GetUID(TRUE);
	printf("Wks UID == %u, Col UID == %u\n", uWksID, uColID);

	// Lets try to use the worksheet ID to get a column object.
	// This will fail of course but we can test for failure and
	// try again with the column ID.
	Column col;
	col = (Column)Project.GetObject(uWksID);
	if( !col )
		col = Project.GetObject(uColID);

	printf("Column name is %s.\n", col.GetName());
}

Remark

Gets internal Unique IDentification number of Origin object. The UID number can be used to refer to an object at a later point in time even if the object is renamed or it's position is changed. The UID will always remain the same.

See Also

Project::GetObject

Header to Include

origin.h