er, what does this line of code mean??
_LIT(KtxMySplashImage ,"\\private\\<My SID>\\splash.mbm" );
and if i have a image, where should i place it so my program can call it??
please help.. thanks
er, what does this line of code mean??
_LIT(KtxMySplashImage ,"\\private\\<My SID>\\splash.mbm" );
and if i have a image, where should i place it so my program can call it??
please help.. thanks
that means that the splash.mbm is supposedly located in your application's private directory, and you should replace the <My SID> with your own private folder's name.
what do u mean by my own private folder? do u mean i can create a folder (ex. Picture folder) in my application(splashscreen) folder?
You should propably read the basics of teh platform security for Symbian OS, the private directoty thing is on of the basics on it, and you can not really do any real programs on Symbian 3rd edition forward without understanding the platform security bsics.
Google would be your best fried on finding information, also we do have search box here, as well as in wiki, so you could do a bit of searching by yourself as well.
Anyway, to get you started here's one link to our wiki: http://wiki.forum.nokia.com/index.ph...Security_Model
_LIT(KtxMySplashImage ,"\\private\\0xEDB0995D\\splash.mbm" );
i know what is my priavte directory... but the splash.mbm i mus put in right?? how do i put in??
Apparently you do not... That 0x would ruin everything.
Otherwise on the device you install the files to your private directory, just as anywhere else.
In the emulator, you can specify "TARGETPATH \\private\\EDB0995D" after "START BITMAP splash.mbm".
yep, and as can be seen from the wiki example: http://wiki.forum.nokia.com/index.ph...implementation, you would need to do the mbm with bmconv and have the splash image put there as a first bitmap of the mbm.
er, currently i am using the code of this website http://wiki.forum.nokia.com/index.ph...lashScreen.zip
i wanted to do a splashscreen like it appear before everything then it will go to the main page...
but when i start, my program will just close?? why does this happen? is it memory leak?? how to solve it?
i run debug and have this errors~
high: canpanic: leaving function called in non-leaving function
high: canpanic: destructor is accessing/dereferencing data member
high: canpanic: ignoring Open() return value
how to solve them?? this errors are in my SplashScreen.h and cpp and ActiveObject.cpp
SplashScreen.h
#include <W32STD.H>
#include <FBS.H>
class CFbsBitmap;
class CSplashScreen
{
public:
CSplashScreen(RArray<TInt>* aBitmapHandle);
~CSplashScreen();
void Show();
void Refresh();
void StopSplashRefresh();
private:
RWsSession iWs;
RWindowGroup iWg;
CWindowGc* iGc;
RWindow iWindow;
CWsScreenDevice* iScreenDevice;
RArray<TInt>* iBitmapHandle;
};
SplashScreen.cpp
const TInt screenWidth = 360;
const TInt screenHeight = 480;
/*
* CSplashScreen::CSplashScreen(RArray<TInt>* aBitmapHandle)
* The aBitmapHandle contains handles to the icon and the mask
*/
CSplashScreen::CSplashScreen(RArray<TInt>* aBitmapHandle)
{
User::LeaveIfError(iWs.Connect());
iScreenDevice = new(ELeave) CWsScreenDevice(iWs);
iScreenDevice->Construct();
TPixelsTwipsAndRotation curPixTwipsRot;
iScreenDevice->GetDefaultScreenSizeAndRotation(curPixTwipsRot);
TRect screenRect = curPixTwipsRot.iPixelSize;
iWg = iWs;
User::LeaveIfError(iWg.Construct(reinterpret_cast<TUint32>(&iWg), EFalse));
iWg.SetOrdinalPosition(10, ECoeWinPriorityAlwaysAtFront);
User::LeaveIfError(iScreenDevice->CreateContext(iGc));
iWindow = iWs;
User::LeaveIfError(iWindow.Construct(iWg, reinterpret_cast<TUint32>(&iWg) + 1));
iWindow.SetBackgroundColor(TRgb(0xff, 0xfa, 0xfa));
iWindow.Activate();
iWindow.SetExtent(TPoint(0, 0), TSize(screenRect.Width(), screenRect.Height()));
iWindow.SetVisible(ETrue);
iBitmapHandle = aBitmapHandle;
}
CSplashScreen::~CSplashScreen()
{
iWindow.Close();
iWg.Close();
if(iGc)
{
delete iGc;
iGc = NULL;
}
if(iScreenDevice)
{
delete iScreenDevice;
iScreenDevice = NULL;
}
iWs.Close();
iBitmapHandle->Reset();
}
/*
* void CSplashScreen::Show()
* Function that begins the redraw and needs to be called only once to avoid flickering
*/
void CSplashScreen::Show()
{
iGc->Activate(iWindow);
TRect rect = TRect(iWindow.Size());
iWindow.Invalidate(rect);
iWindow.BeginRedraw(rect);
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
iGc->Clear();
Refresh();
}
/**
* Function to refresh the view repeatedly so that the welcome screen holds for sometime
*/
void CSplashScreen::Refresh()
{
TRect rect = TRect(iWindow.Size());
//create the bitmap for this thread using the handle passed. No need to clean up as it creates only a pointer to the existing icon
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
bitmap->Duplicate((*iBitmapHandle)[0]);
//create the bitmap mask for this thread using the handle passed. No need to clean up as it creates only a pointer to the existing icon
CFbsBitmap* bitmap_mask = new (ELeave) CFbsBitmap();
bitmap_mask->Duplicate((*iBitmapHandle)[1]);
//Draw the icon from the center of the screen
iGc->BitBltMasked(TPoint(0, 0), bitmap, rect, bitmap_mask, ETrue);
iGc->DrawRect(TRect(TPoint(50,100), TSize(40,40)));
StopSplashRefresh();
}
/**
* Called to end the redraw and flush the Window Server
*/
void CSplashScreen::StopSplashRefresh()
{
iWindow.EndRedraw();
iGc->Deactivate();
iWs.Flush();
}
ActiveObject.cpp
CActiveObject* CActiveObject::NewL(MWaitObserver& aMyObserver, RArray<TInt>* aBitmapHandle)
{
CActiveObject* self=new (ELeave) CActiveObject(aMyObserver);
self->ConstructL(aBitmapHandle);
return self;
}
void CActiveObject::ConstructL(RArray<TInt>* aBitmapHandle)
{
iSplashScreen = new(ELeave) CSplashScreen(aBitmapHandle);
}
CActiveObject::CActiveObject(MWaitObserver& aMyObserver)
:CActive(CActive::EPriorityStandard),
iMyObserver(aMyObserver)
{
CActiveScheduler::Add(this);
iThisThread.Open(RThread().Id());
actThread.Create(_L("SplashThread"),CActiveObject::MyThread, KDefaultStackSize, NULL,this);
}
CActiveObject::~CActiveObject()
{
actThread.Terminate(KErrNone);
Cancel();
if(iSplashScreen)
{
delete iSplashScreen;
iSplashScreen = NULL;
}
}
void CActiveObject::ThreadSuspend()
{
TRequestStatus* requestStatus = &(iStatus);
iThisThread.RequestComplete(requestStatus, KErrGeneral);
actThread.Suspend();
}
void CActiveObject:oCancel()
{
}
void CActiveObject::IssueRequest(TInt aCounter)
{
iCounter = aCounter;
iStatus = KRequestPending;
SetActive();
actThread.Resume();
}
void CActiveObject::RunL()
{
if(iStatus == KErrNone && iCounter < 10)
{
iSplashScreen->Show();
iMyObserver.DoReDraw();
}
else if(iStatus == KErrGeneral)
{
}
else
{
iMyObserver.ThreadNotify();
}
}
TInt CActiveObject::MyThread(TAny* aPkg)
{
RThread thisThread;
while(ETrue)
{
CActiveObject* active = static_cast<CActiveObject*>(aPkg);
User::After(1*1000*1000);
TRequestStatus* requestStatus = &(active->iStatus);
(active->iThisThread).RequestComplete(requestStatus, KErrNone);
thisThread.Suspend();
}
}
These are not the Run or debug errors.
these are the errors when you run the code scanner on your code.
If you want to remove these errors then you must follow the symbian coding conventions.
for ex.
a simple one:
CSplashScreen() is the constructor of the class which must not leave..
And you are usign LeaveIfError() here.
o... ok... then how do i revert it back to normal??