Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

I am trying to implement some siimple application functionality and run the code in the BREW simulator with SDK 3.1.5. I have tried using ISHELL_LoadImage and my own code below:

IImage* MyLoadImage(IShell* pIShell, const char* fileName, const char *mimeType)
{
int err = EFILEEXISTS;
IFileMgr* pFM;
IFile* pFile;
IImage* pIImage = NULL;
AEECLSID cls = ISHELL_GetHandler(pIShell, HTYPE_VIEWER, mimeType);

ISHELL_CreateInstance(pIShell, AEECLSID_FILEMGR, (void **)&pFM );

pFile = IFILEMGR_OpenFile(pFM, fileName, _OFM_READ);
err = IFILEMGR_GetLastError(pFM);

if (pFile)
{
ISHELL_CreateInstance(pIShell, cls, (void **)(&pIImage));
IIMAGE_SetStream(pIImage, (IAStream*)pFile);
IFILE_Release(pFile);
}

IFILEMGR_Release(pFM);
return pIImage;

Both return a null pIImage and the code above creates a NULL pFile and err is set to 266 decimal, which is EINVALIDOPERATION.

When using a file name with a path, what should the syntax be for the pszFile parameter in IFILEMGR_OpenFile?

In what Windows directory should a file be stored to be accesible by the simulator?

bbogard wrote:When using a file name with a path, what should the syntax be for the pszFile parameter in IFILEMGR_OpenFile?
it should contain full file path - like fs:/shared/abc.jpg... Also make sure that the app has necessary privileges to access that file...
bbogard wrote:In what Windows directory should a file be stored to be accesible by the simulator?
The examples folder (usually %brewsdk%\examples folder) is the simulated target root folder in windows

bbogard wrote:When using a file name with a path, what should the syntax be for the pszFile parameter in IFILEMGR_OpenFile?
it should contain full file path - like fs:/shared/abc.jpg... Also make sure that the app has necessary privileges to access that file...
bbogard wrote:In what Windows directory should a file be stored to be accesible by the simulator?
The examples folder (usually %brewsdk%\examples folder) is the simulated target root folder in windows