About the author
While working on a support case involving StarTeam and CaliberRM, I had to write a program to see which of the following scenario is true:
So guess what language I chose to use? Delphi! ;o)
Given:
var Folders: IStCollection; V: OleVariant;
and that Folders has an Items default property returning a IStCollection,
I had to cast Folders[ItemIndex]: OleVariant to another interface, IStFolder (var Folder: IStFolder)
So, I tried this:
Folder := Folders[ItemIndex];
and got “[Pascal Error] StarTeamFolderEnumerator.pas(70): E2010 Incompatible types: 'IStFolder' and 'OleVariant'”.
And this:
Folder := Folders[ItemIndex] as IStFolder;
and got “[Error] StarTeamFolderEnumeratorImpl.pas(61): E2015 Operator not applicable to this operand type”.
My good friend, Tim to the rescue again! It turns out that I have to cast Folders[ItemIndex] to an IDispatch first, before casting it to an IStFolder, because Folders[ItemIndex] is an OleVariant, which, in this case, is just an IDispatch.
V := Folders[ItemIndex];Folder := IDispatch(V) as IStFolder;
Tim explains,
“
”
Learn why the map is cool in Go!
A method to design records so that they're allocated on a specific byte boundary, such as 16 bytes, 512 bytes, 4096 bytes, etc.
Learn the command line used to compile System.pas in Delphi
How to free more space on your home drive by redirecting the location for SDKs in RAD Studio