![]()
This sample code shows how to send a launch code to Resco Viewer to display a BMP, JPEG, PNG, GIF or TIF/F images.
After viewing, Resco Viewer will return to the app that sent the launch code.
Compatibility: Since Resco Viewer 1.30, Tif/F since v2.10, PNG since v2.50
Handheld Basic interface
PDA Toolbox interface
This is an interface designed to launch RescoViewer from another application via custom launch code.
The interface was originally designed for ZLauncher and was employed later by UniCmd and Resco Explorer.
The interface consists of 2 functions:
// Launch code
#define sysAppLaunchCmdRescoPhotoViewer_ShowImage (sysAppLaunchCmdCustomBase + 0x0010)
// Parameter structure
typedef struct tagRPVParams
{
UInt32 versionNumber; // set to zero
Boolean isInternal; // true: item is stored in RAM and data.internal is available
// false: item is stored on the card and data.external is available
UInt8 padding; // 16-bit aligned, set to zero
union
{
// RAM interface can be used for:
//
// dbType dbCreator description
// -------------------------------------------------
// 'tJPG' 'IMGV' // Resco RAM jpeg
// '.BMP' 'IMGV' // Resco RAM bmp
// '.GIF' 'IMGV' // Resco RAM gif
// '.PNG' 'IMGV' // Resco RAM png
// 'tRAB' 'IMGV' // Resco RAM album
// 'Camr' 'Foto' // Zire 71 camera
// 'Foto' 'Foto' // Palm Photos
// '.jpg' 'FLDB' // Clie camera
//
struct // isInternal == true
{
UInt16 cardNo;
LocalID dbID;
UInt32 creator;
UInt32 type;
Char dbName[dmDBNameLength];
} internal;
// Card interface can be used for jpg, gif, png, tif/F and bmp files and *.rab (Resco albums)
//
struct // isInternal == false
{
UInt16 volRefNum; // volume reference number of the expansion card
Char fullPathName[256]; // full image path, NULL-terminated
} external;
}
data;
}
RPVParams;
// Internal utility
static Err RPVLaunch( RPVParams *params )
{
RPVParams *rv ;
LocalID appDbID ;
DmSearchStateType stateInfo ;
UInt16 cardNo ;
Err err = DmGetNextDatabaseByTypeCreator( true, &stateInfo, sysFileTApplication,
'IMGV', false, &cardNo, &appDbID ) ;
if( appDbID == 0 )
return err ;
rv = (RPVParams*)MemPtrNew( sizeof(RPVParams) ) ;
if( rv==NULL )
return memErrNotEnoughSpace ;
*rv = *params ;
rv->versionNumber = 0 ;
rv->padding = 0 ;
MemPtrSetOwner(rv, 0) ;
return SysUIAppSwitch(0, appDbID, sysAppLaunchCmdRescoPhotoViewer_ShowImage, rv);
}
// Display RAM-based image
Err RPVOpenDbImage( LocalID dbID, const Char *dbName, UInt32 creatorID, UInt32 dbType )
{
RPVParams rv ;
rv.isInternal = true ;
rv.data.internal.cardNo = 0 ;
rv.data.internal.dbID = dbID ;
rv.data.internal.creator = creatorID ;
rv.data.internal.type = dbType ;
StrCopy( rv.data.internal.dbName, dbName ) ;
return RPVLaunch( &rv ) ;
}
// Display Card-based image
Err RPVOpenFileImage( UInt16 volRefNum, const Char *fullPath )
{
RPVParams rv ;
rv.isInternal = false ;
rv.data.external.volRefNum = volRefNum ;
StrCopy( rv.data.external.fullPathName, fullPath ) ;
return RPVLaunch( &rv ) ;
}
This is an interface designed to launch RescoViewer from an HB++ application.
The interface is based on the C language interface described above.
The following sample shows how to launch Resco Viewer for a card image.
Similar code can be written for RAM based images - see the definition of RPVParams structure above.
Steps:
Private const sysAppRescoViewer_ShowImage as Long = &H8010
Private Sub Form_Load()
Field1.Text="/DCIM/MyImage.jpg"
End Sub
Private Sub Button1_Click()
Dim di as new DatabaseInfo
Dim v as new VFSVolume
Dim sParam as new StreamMemory
Dim szFilePath as String
if not v.FindFirstVolume then exit sub
szFilePath = Field1.Text
Write sParam, Clng(0)
Write sParam,False
Write sParam, Cbyte(0)
Write sParam, v.Reference
Write sParam, szFilePath
If di.FindByName("RescoViewer") then
di.Shell True,sysAppRescoViewer_ShowImage,sParam
End if
End Sub
When you start the app, you can enter the image path in the text field and hit the button to start Resco Viewer.
If Resco Viewer isn't installed, nothing will happen.
This is an interface designed to launch RescoViewer from another application via command passed in the clipboard. The commands are processed as part of the standard sysAppLaunchCmdNormalLaunch processing.
The interface was originally designed to support PDA Toolbox. (Original idea by Honza Martasek; you may contact him in case of troubles with PDA Toolbox interface.)
Launch command is transferred via clipboard as a text item with the format:
RescoViewer tries to show the passed image or album. The user can do standard actions such as zooming, color editing etc. What he can't do is changing to another image. (However, albums can be browsed.) After quitting the image view, the Resco Viewer terminates and the control returns to the calling application.
On exit, the operation result is returned via clipboard as a text item containing:
Remarks:
Launches RescoViewer on the supplied folder.
If the folder is not found, the viewer starts on the default folder.
On exit, the clipboard always contains "$0". (This is to enable subsequent normal start of the Resco Viewer.)
Anything else found on the clipboard (incl. command syntax error!) is ignored and RescoViewer starts on the default folder.
| Examples: | |
|---|---|
| $RescoViewV;0:default | RAM album |
| $RescoViewV;0:nikon-e950 | RAM jpeg |
| $RescoViewV;0:DSC00001 | RAM camera image |
| $RescoViewV;1:/OS2logo.bmp | Card bitmap file |
| $RescoViewV;1:/ViewerTour.rab | Card album |
| $RescoViewV;1:/anima/comics15d.gif | Animated gif |
| $RescoViewL;1:/Palm/Programs/RescoViewer | Card directory |
Copyright © 2004 Resco, Ltd. All rights reserved.