Adobe COLDFUSION 9 Manual page 1169

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using Web Elements and External Objects
<!--- Create a query for the drive information results. --->
<cfset result=QueryNew("name,type,isready,format,label,totalsize,freespace"
,"varchar,varchar,bit,varchar,varchar,double,double")>
<!--- Create a .NET System.IO.DriveInfo object. --->
<cfobject type=".NET" name="sidiClass" class="System.IO.DriveInfo">
<!--- Get the drives. --->
<cfset drives=sidiClass.GetDrives()>
<!--- Loop through drives. --->
<cfloop from="1" to="#ArrayLen(drives)#" index="i">
<!--- Add a row to the query.--->
<cfset QueryAddRow(result)>
<!--- Get the drive name, type, and ready flag. --->
<cfset QuerySetCell(result, "name", drives[i].Get_Name())>
<cfset QuerySetCell(result, "type",
drives[i].Get_DriveType().ToString())>
<cfset QuerySetCell(result, "isready", drives[i].Get_IsReady())>
<!--- Get extra details ONLY if the drive is ready. --->
<cfif drives[i].Get_IsReady()>
<cfset QuerySetCell(result, "format", drives[i].Get_DriveFormat())>
<cfset QuerySetCell(result, "label", drives[i].Get_VolumeLabel())>
<cfset QuerySetCell(result, "totalsize", drives[i].Get_TotalSize())>
<cfset QuerySetCell(result, "freespace",
drives[i].Get_AvailableFreeSpace())>
</cfif>
</cfloop>
<cfdump var="#result#">
.NET Interoperability Limitations
ColdFusion .NET interoperability has the following limitations
• You cannot invoke methods with pointers as arguments or the return type.
• You cannot invoke methods that take Out parameters.
• ColdFusion can only convert from System.Data.DataTable, System.Collection.Hashtable and
System.Collection.ArrayList to ColdFusion data types. ColdFusion cannot convert from ColdFusion queries,
structures, and arrays to these System data types; however, it can convert from ColdFusion arrays to the CLR array
type. Therefore, you cannot pass structures or queries directly to .NET methods.
• You cannot access .NET user interface components.
• You cannot use callbacks (events and Delegates) from .NET side.
• ColdFusion cannot determine the correct data type conversion if a method has multiple signatures that have the
same number of parameters and differ only in the parameter data types. In this case, use the JavaCast method to
convert the ColdFusion data to the Java type that corresponds to the .NET type.
• If the
function cannot eliminate ambiguity between functions with the same number of parameters
JavaCast
because a single Java type corresponds to multiple .NET types, ColdFusion creates a single proxy that uses the .NET
data type that corresponds directly to a Java type.
For more information on how to ambiguous handle type conversions, see
ColdFusion data
types" on page 1157.
Last updated 8/5/2010
"Converting between .NET and
1164

Advertisement

Table of Contents
loading

Table of Contents