Moving a .WMF file to a BLOB 
Author Message
 Moving a .WMF file to a BLOB

In CW2003, I am trying to move a wmf file into a BLOB. End result would
be a database of previously generated reports.
Problem: When I follow the example and do
File:Blob{Prop:Handle} = ?Image{PROP:ImageBlob}
I never get anything in the blob. As such, I am wondering if
1) This don't work period.
2) There is a way to do it.
3) If 2, then how?

Thanks to anyone who reads this!
Many thanks to anyone who has answers! <BG>



Sat, 04 Aug 2001 03:00:00 GMT  
 Moving a .WMF file to a BLOB
John!

I had a similar problem (I think) when doing multi-detail and the thing that
got me out of it was SetTarget, if I remember correctly. This is a bit
stale, but I think Clarion had a bit of a problem figuring out if I wanted
the stuff from the current Window or the current report. If you don't get it
right feel free to email me and I'll try to hunt it down in my stuff.

I have actually moved away from storing images in BLOBs, simply because my
browses got EXTREMELY slow even though the image wasn't being shown outside
of the update/form. What I do now is to have a clever little numbering
scheme (to remove the file's original identity and hide it from the user)
which I use to store a copy in a special subdirectory.

HTH

Quote:

>In CW2003, I am trying to move a wmf file into a BLOB. End result would
>be a database of previously generated reports.
>Problem: When I follow the example and do
>File:Blob{Prop:Handle} = ?Image{PROP:ImageBlob}
>I never get anything in the blob. As such, I am wondering if
>1) This don't work period.
>2) There is a way to do it.
>3) If 2, then how?

>Thanks to anyone who reads this!
>Many thanks to anyone who has answers! <BG>



Sat, 04 Aug 2001 03:00:00 GMT  
 Moving a .WMF file to a BLOB
Use this example code for the BYTES function (from the C5 help):

DosFileName  STRING(260),STATIC

LastRec     LONG
SavPtr     LONG(1)              !Start at 1
FileSize   LONG
DosFile    FILE,DRIVER('DOS'),PRE(DOS),NAME(DosFileName)
Record     RECORD
F1        STRING(2000)
       . .
BlobStorage  FILE,DRIVER('TopSpeed'),PRE(STO)
File      BLOB,BINARY
Record     RECORD
FileName     STRING(64)
       . .
 CODE
 IF NOT FILEDIALOG('Choose File to Store',DosFileName,,0010b) THEN RETURN.
 OPEN(BlobStorage)               !Open the BLOB file

STO:FileName = DosFileName           ! and store the filename
 OPEN(DosFile)                 !Open the file
 FileSize = BYTES(DosFile)            !Get size of file
 STO:File{PROP:Size} = FileSize         ! and set the BLOB to store the file
 LastRec = FileSize % SIZE(DOS:Record)     !Check for short record at end of
file
 LOOP INT(FileSize/SIZE(DOS:Record)) TIMES
  GET(DosFile,SavPtr)             !Get each record
  ASSERT(NOT ERRORCODE())

STO:File[SavPtr - 1 : SavPtr + SIZE(DOS:Record) - 2] = DOS:Record
                        !String slice data into BLOB
  SavPtr += SIZE(DOS:Record)          !Compute next record pointer
 END
 IF LastRec                   !If short record at end of file
  GET(DosFile,SavPtr)             !Get last record
  ASSERT(BYTES(DosFile) = LastRec)       ! size read should match computed
size
  STO:File[SavPtr - 1 : SavPtr + LastRec - 2] = DOS:Record

END
 ADD(BlobStorage)
 ASSERT(NOT ERRORCODE())
 CLOSE(DosFile);CLOSE(BlobStorage)

HTH,

Richard Taylor

Quote:

>In CW2003, I am trying to move a wmf file into a BLOB. End result would
>be a database of previously generated reports.
>Problem: When I follow the example and do
>File:Blob{Prop:Handle} = ?Image{PROP:ImageBlob}
>I never get anything in the blob. As such, I am wondering if
>1) This don't work period.
>2) There is a way to do it.
>3) If 2, then how?

>Thanks to anyone who reads this!
>Many thanks to anyone who has answers! <BG>



Sat, 04 Aug 2001 03:00:00 GMT  
 Moving a .WMF file to a BLOB
Quote:

> In CW2003, I am trying to move a wmf file into a BLOB. End result would
> be a database of previously generated reports.
> Problem: When I follow the example and do
> File:Blob{Prop:Handle} = ?Image{PROP:ImageBlob}
> I never get anything in the blob. As such, I am wondering if
> 1) This don't work period.
> 2) There is a way to do it.
> 3) If 2, then how?

Doesnt work. Prop:imageBlob doesnt produce anything if a wmf (non-bitmap)
is loaded into the image control.  What you have to do is call
globalalloc and allocate enough memory to hold the wmf.  Then read the
wmf from file into the global memory block. Then assign the handle of the
global memory block to file.blob{prop:handle}=hglobal and then free the
hglobal.  You could also string slice but I'm always worried I'll miss a
bit and be one off somewhere.  Unpacking the blob is the reverse.
---
Jim Kane  - TeamTopSpeed
Productive Software Solutions
Can't Find that Message?
Get Organized, Get ForKeeps!
www.fkeeps.com


Sat, 04 Aug 2001 03:00:00 GMT  
 Moving a .WMF file to a BLOB
Jim, Daan, and Richard,
Thanks for the advice! I'm going to use Richard's solution as I've
already got the file handy. This way I can get rid of the window and
image I was using for this and just grab the sucker. I'll also need to
look at Globalalloc as a way of moving it into an image for
preview/printing though.

Thanks!



Sun, 05 Aug 2001 03:00:00 GMT  
 Moving a .WMF file to a BLOB
Jim, I take it there's no way to directly move a .wmf file from inside a
BLOB over to the image then? I'm not sure how the image control works on
a low lever, but I was figuring it would have a memory image of whats on
disk somewhere that I could copy over. Real bummer if it doesn't.

Side question, what command(s) do I use to read from disk to a memory
location? I've not gotten into the API field enough to figure this out
(Yet).



Sun, 05 Aug 2001 03:00:00 GMT  
 Moving a .WMF file to a BLOB
Quote:

> Jim, I take it there's no way to directly move a .wmf file from inside a
> BLOB over to the image then? I'm not sure how the image control works on
> a low lever, but I was figuring it would have a memory image of whats on
> disk somewhere that I could copy over. Real bummer if it doesn't.

You need to go blob to *.WMF on disk and use prop:TEXT to assign to the
image control.
In 16 bit you use _lopen, _lread or _hread and in 32 bit createfile() and
readfile() each with a zillion parameters.
---
Jim Kane  - TeamTopSpeed
Productive Software Solutions
Can't Find that Message?
Get Organized, Get ForKeeps!
www.fkeeps.com


Sun, 05 Aug 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. cw2003: transfer blob into dos files, transfer dos files into blob

2. add multiple WMF-images to 1 WMF-file

3. copy temporary report wmf.file to permanent wmf

4. CW4a - IMAGEs, .WMF and BLOBs vs MEMOs

5. WMF TO BLOB

6. Converting PDF files to WMF files

7. How to convert WMF files to RTF files?

8. VW: Interface with CADand WMF-files

9. Printing a report to a WMF file

10. WMF Report file location

11. Found a great way to make WMF files!

12. How do I print a saved WMF File?

 

 
Powered by phpBB® Forum Software