Hi,
I am using Palm OS 5 on Tungsten E and my application
needs to capture the screen at runtime and display it
later.
The following code segment for the same crashes when I
load it. Is it because of accessing the memory
directly? or where is the problem?
CODE:
WinHandle drawWindow,bufferdrawWindow;
BitmapType* drawBitmap;
UInt16 bmpSize;
UInt16* winBaseAddress;
UInt16* bmpBaseAddress;
UInt16* bufferBaseAddress;
UInt16 theSize,bmpDepth;
Int16 extentX,extentY;
int CaptureScreen()
{
drawWindow = WinGetDisplayWindow();
drawBitmap = WinGetBitmap(drawWindow);
bmpSize = BmpBitsSize (drawBitmap);
bmpDepth = BmpGetBitDepth (drawBitmap);
BmpGetDimensions
(drawBitmap,&extentX,&extentY,&bmpSize);
bmpbitssize = 1L*bmpDepth*extentX*extentY/8;
bmpBaseAddress =
(UInt16*)MemGluePtrNew(bmpbitssize);
winBaseAddress = (UInt16*)MemPtrNew(bmpbitssize );
if (bmpBaseAddress == NULL)
return 0;
memcpy(winBaseAddress,bmpBaseAddress,bmpbitssize );
return ;
}
int loadScreen()
{
bufferdrawWindow = WinCreateOffscreenWindow(160,
160, screenFormat, &error);
bufferdrawBitmap = WinGetBitmap(bufferdrawWindow);
bufferBaseAddress =(UInt16*)
BmpGetBits(bufferdrawBitmap);
memcpy(bufferBaseAddress , bmpBaseAddress,
bmpbitssize );
WinSetDrawWindow(bufferdrawWindow);
return 1;
}
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/