PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
New WINDEV Mobile 24 feature!
  • Selecting a resource
  • Management of the conversion type
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
URIGetInfo (Function)
In french: URIRécupèreInfo
Retrieves information of a URI resource.
Example
// Save a resource with conversion

// Open the system window to select a resource
UriResource is URI = URISelect()
IF NOT ErrorOccurred THEN
// Displays the name of the selected resource
Info(URIGetInfo(UriResource, uriInfoName))
END

UriResource is URI = URISelect()
IF NOT ErrorOccurred THEN
// Retrieves the MIME type into which the resource can be converted
sMIMEType is string = URIGetInfo (UriResource, uriInfoConversionType)
IF sMIMEType <> "" THEN
// If there are several possible MIME types
IF StringCount(sMIMEType, TAB) > 1 THEN
// Ask the user to choose the type to use
...
END
// Save the resource on the device
URIToFile(UriResource, SysDirExternalStorage(1, sseAppDocument), ...
ProcEndSave, sMIMEType)
INTERNAL PROCEDURE ProcEndSave (bResult, sResourcePath)
IF bResult THEN
ToastDisplay(StringBuild("File saved (%1)", ...
sResourcePath))
END
END
END
END
Syntax
<Result> = URIGetInfo(<URI> , <Information>)
<Result>: Character string or Integer
Requested information.
The ErrorOccurred variable is set to True if an error occurred. To find out the error details, use ErrorInfo.
<URI>: URI or Character string variable
Name of the URI variable or character string that identifies the resource being handled.
<Information>: Integer constant
Requested type of information:
uriInfoNameName of the resource (without extension).
uriInfoSizeSize of the resource. <Result> will correspond to an integer:
  • Size of the resource (in bytes).
  • -1 if the size is not known or cannot be retrieved.
uriInfoConversionType MIME types (and corresponding file extensions) into which the resource can be converted when being exported. In this case, <Result> will correspond to a character string in the following format:
<MIME type> + TAB + <Extension>

Example: "application/pdf + TAB + .pdf"
If the function returns several types, they will be separated by CR.
See the Notes of this page for more details.
uriInfoOriginTypeOriginal MIME type of the resource and corresponding file extension. In this case, <Result> will correspond to a character string in the following format:
<MIME type> + TAB + <Extension>

Example: "application/pdf + TAB + .pdf"
Remarks

Selecting a resource

To select a resource and retrieve its URI, use URISelect, for example.

Management of the conversion type

The constant uriInfoConversionType makes it possible to retrieve the MIME types in which the resource can be converted.
This information is especially useful when using URIToFile and URIToBuffer to determine the format in which the resource will be retrieved. Indeed, when selecting a resource that does not come from the device's file system, the content provider that manages the resource may need to convert it.
This is usually the case if no application on the device can manage the original format of the resource. If the resource can be exported without conversion, URIGetInfo will return the same value as with the constant uriInfoOriginType.
Example:
a Microsoft Word file (.doc or.docx) is selected using URISelect. This file is on Google Drive and no application on the device can handle this type of document. When saving this resource, the content provider will automatically convert this resource to PDF format. In this case, URIGetInfo used with the constant uriInfoConversionType will return the following string: "application/pdf + TAB + .pdf".
Component : wd240android.jar
Minimum required version
  • Version 24
Comments
Click [Add] to post a comment