SalExtension: SalPicHandleToString( ) ?

forum.advanced.programming (1998-2005)
StefanM
Germany
Posts: 679
Joined: 10 Aug 2018, 15:57
Location: Bavaria

SalExtension: SalPicHandleToString( ) ?

Post by StefanM » 23 Jan 2005, 14:55

 Posted by:  Stefan Misch 

Hi NG,

in SalExtension.apl there is a function called SalPicStringToHandle( ),
which returns a bitmap handle for a string containing a picture object. I
need the opposite. I have a bitmap handle and need to get the string data,
so that I could send the picture data to a report using
SalReportSetObjectVar( ).

I could use SalPicSetHandle( ) to display the bitmap in a picture object and
the use SalPicGetString( ) to get the string I want, but I need this
functionality in a functional class and I don't like the idea of creating a
hidden form window with a picture object just to convert the bitmap handle
into a bitmap string.

I guess some of the WinSDK or ImgMan gurus certainly already solved this.

TIA,
Stefan

micsto
Germany
Posts: 997
Joined: 07 Mar 2017, 16:07
Location: Germany

Re: SalExtension: SalPicHandleToString( ) ?

Post by micsto » 24 Jan 2005, 10:09

 Posted by:  Michael Stoll \( MICSTO \) 

Hi Stefan,

you could use M!Image (www.micsto.de ) to get the bitmap string:

Set hImage = MImgLoadFromHandle( hBitmap, MIMG_TYPE_BMP )
Call MImgGetString( hImage, sStr, MIMG_TYPE_BMP )
Call MImgDelete( hImage )

Michael

StefanM
Germany
Posts: 679
Joined: 10 Aug 2018, 15:57
Location: Bavaria

Re: SalExtension: SalPicHandleToString( ) ?

Post by StefanM » 24 Jan 2005, 12:54

 Posted by:  Stefan Misch 

Michael,

thanks, I know that I could use M!Image, but customer's policy is not to use
any third party tools.

Any "pure" WinSDK solution?

Stefan

StefanM
Germany
Posts: 679
Joined: 10 Aug 2018, 15:57
Location: Bavaria

Re: SalExtension: SalPicHandleToString( ) ?

Post by StefanM » 25 Jan 2005, 21:48

 Posted by:  Stefan Misch 

I'm still struggling...

I tried this SalPicSetHandle( ) ... SalPicGetString( ) work-around, I
explained below.
After SalPicSetHandle( ) I see the picture in the SAL picture object on the
form window. But the bitmap ist not displayed in the report, I just see
'BM|' in the reports picture object. Please see the attached sample.

I guess I get in conflict with TD adding the type prefix to the picture
object, once I fill the picture using SalPicSetHandle( ).
Any help for me out there?

Thanks,
Stefan

micsto
Germany
Posts: 997
Joined: 07 Mar 2017, 16:07
Location: Germany

Re: SalExtension: SalPicHandleToString( ) ?

Post by micsto » 28 Jan 2005, 15:40

 Posted by:  Michael Stoll \( MICSTO \) 

Hi Stefan,

here is a pure Sal solution for TD 3.1 with a little help of cstructl.apl.
The attached ZIP-archive contains two files:

-mbitmap.apl:
Library which provides the function MBitmapGetStr.

bOk = MBitmapGetStr( p_hBitmap, p_nBitcount, r_sString )

The bitcount parameter can be used to modify the color depth of the
generated bitmap string.
Valid values are:
0 (Use color depth from HBITMAP)
1 (Monochrome)
4 (16 Colors)
8 (256 Colors)
16 (High color)
24 (True color)
32 (True color)

-bitmapstring.app:
Demo application which loads a HBITMAP from a file and generates the bitmap
string.
The HBITMAP and the string are displayed in picture objects ( using
SalPicSetHandle for HBITMAP and SalPicSetString for the string ).
Furthermore, the string can be saved as file.

Hope that helps
Michael

P.S. Maybe this is a useful function for SalExtension. Thomas, are you
listening ;o)

You do not have the required permissions to view the files attached to this post.

StefanM
Germany
Posts: 679
Joined: 10 Aug 2018, 15:57
Location: Bavaria

Re: SalExtension: SalPicHandleToString( ) ?

Post by StefanM » 28 Jan 2005, 18:09

 Posted by:  Stefan Misch 

Michael,

wow, thanks for this sample!

I imported MBitmap.apl into my test application, but it still does not work,
the result is (nearly) the same, instead of a graphic I see some letters in
the report object. At next I modified your Bitmapstring.apl to show a report
preview. Et volià - here it works. Although I can see the bar graphic in my
sample application in my child table window, I'm still not able to print it.
So I'm still doing something wrong or missing some hidden detail the way I
create the bar.

Please find attached your modified sample (MBitmapstring.apl plus the .qrp
file) and my sample apt, which now uses MBitmap.apl to print the report.

I would really appreciate if someone can have a look at it, what I may be
doing wrong.

Thanks a lot!
Stefan

You do not have the required permissions to view the files attached to this post.

StefanM
Germany
Posts: 679
Joined: 10 Aug 2018, 15:57
Location: Bavaria

Re: SalExtension: SalPicHandleToString( ) ?

Post by StefanM » 01 Mar 2005, 10:27

 Posted by:  Stefan Misch 

FYI:

I will get in contact with Gupta/LogABug again as Test D is IMHO a bug, too.

Stefan

Log-A-Bug @ Gupta Technologies has reviewed the issue listed below.

Test A: Determined that this is a defect. The defect number is 82515.
Test B: Determined that this is a defect. The defect number is 82519
Test C: Bug 1: ReportBuilder *always* displays the bitmap. Determined
that this is a defect. The defect number is 82520.

Test C: Bug 2: ReportBuilder prints bitmap on the wrong line. Determined
that this is a defect. The defect number is 82522.

Test C: Bug 3: Property dialog for picture object always uses "inch" on
tab "Appearance", although "unit" is set to "centimeter" in report
preferences. Determined that this is a defect. The defect number is 76246.

Test D: Determined that there is insufficient information to determine
exactly what the problem is that is being reported. The problem sounds like
one of the above issues already logged.

Thank you,

Log-A-Bug

Return to “advanced.programming”

Who is online

Users browsing this forum: [Ccbot] and 0 guests