How can I create a screenshot with gSavebit ? When I save a screen with gSavebit "Test",600,200 the file ist not readable by PC or 9300.
Create Screenshot with gSavebit ?
If you create a bitmap with gSaveBit, the imaging application cannot open it directly from FileManager, but you can open it by starting imaging and then press Ctrl+Shift+O and open the file.
On the PC you have to convert it to a bitmap first. You can use BMCONV for this.
Do you mean imaging on the Communicator ? I can't open it by imaging, the program doesn't find a file. What's wrong ? Is it necessary to write a file extension like .mbm or .bmp ? Is it possible to save a bitmap as .bmp ?
No idea what's wrong. Did you try opening it in OPL and see if that works? If you can load the saved file with gLOADBIT, then at least it's a valid MBM file.
Normally when you write an MBM file with gSAVEBIT you cannot directly open it with Imaging on the Communicator by selecting it from FileManager. However if you open Imaging and then press Ctrl+Shift+O and select the file, it is displayed correctly.
File extensions are unnecessary on Symbian (except for non-native file types like txt,doc,pdf etc) since each Symbian native format has a couple of UIDs at the beginning of the file that specify which application can open these files.
It is not possible to save a bitmap from OPL unless you know the bitmap format and write it yourself completely. In the future maybe some of the more advanced image handling routines in MediaServer can be put into the MediaServer OPX for loading and saving jpg, gif etc.
If you're still having problems, please post some example code of what you're doing and maybe a saved mbm file.
Yes, I can open i it with gLOADBIT. But Imaging shows no icon when I search the file ! It can't identify it as a graphic file.
The I have saved: Link
The code is:
Proc Test:
global win%
win%=gcreate(0,0,600,200,1,$111)
gborder 0
gat 10,10
gfill 80,80,0
ggrey 1
gat 20,20
gill 80,80,0
gsavebit "Test",600,200
get
endp
I think the embedded UID in the mbm saved by the gSAVEBIT is the UID of the application that creates it, which in this case is the runtime. You need to reset the UID of the resulting saved file, but I can;t remember the values.
The code looks ok and if you can load it with gLOADBIT than the generated MBM is ok. In order to open it in Imaging, you have to select "Show all files" in the Imaging's open file dialog. Otherwise it won't show.
As Ewan suggested, you can also rewrite the UID's of the file saved by gSaveBit so that it is correctly recognized by Imaging as an MBM-file. If you need some example code how to do this, let me know and I'll send it to you.
As Ewan suggested, you can also rewrite the UID's of the file saved by gSaveBit so that it is correctly recognized by Imaging as an MBM-file. If you need some example code how to do this, let me know and I'll send it to you.
Yes please send me the code, thanks.
If you create a bitmap with gSaveBit, the imaging application cannot open it directly from FileManager, but you can open it by starting imaging and then press Ctrl+Shift+O and open the file.
Do you speak about 9210 ? On the 9300 is no function like this ?!
The code below will patch the UIDs of an MBM file so that is correctly recognized by the system (and can be opened with the Imaging application on the 9210 directly from FileManager). It is untested, so use at your own risk.
Res%=IOOPEN(Handle%,FileName$,KIoOpenModeOpen% OR KIoOpenFormatBinary% OR KIoOpenAccessRandom%)
IF Res%<>0
AFInformationDialog%😞"Error opening file","An error occurred trying to open the MBM file."😉
RETURN
ENDIF
UID&=268435511
IOWRITE(Handle%,ADDR(UID&😉,KLongIntWidth&😉
UID&=268435522
IOWRITE(Handle%,ADDR(UID&😉,KLongIntWidth&😉
UID&=0
IOWRITE(Handle%,ADDR(UID&😉,KLongIntWidth&😉
UID&=1194943545
IOWRITE(Handle%,ADDR(UID&😉,KLongIntWidth&😉
IOCLOSE(Handle%)
Thx for the code ! But how what must I do with it, is ot for the gSavebit Routine ?
Just put this code directly after the call to gSAVEBIT (assuming the file you saved is in FileName$)