View Single Post
  #1  
Old 08-16-2019, 03:57 PM
FreakaZoid2 FreakaZoid2 is offline
Senior Member
 
Join Date: Jul 2009
Posts: 362
Default acucobol bitmap from delphi dll

Ok I have my dll that creates a bitmap but I am trying to figure out how to send it back to acucobol program.
I can modify the dll however it takes. This is the latest changes I have tried.
ACUCOBOL has the ability to load bitmaps but always from a file never from another bitmap or stream or anything like that. cobol then dll code shown.
The background behind this is to never save the signature image to a drive ever.
NOTE: The acucobol library for bitmaps ALL require a file name, so this may not be possible.
Code:
 01  abitmap                   handle.
….
    call 'GetMeAbitmap' using 
         lnk-b64-string 
         by reference abitmap 
    end-call.
….
Code:
procedure GetMeAbitmap(aStr : PAnsiChar; aHandle : THandle); stdcall;
var
  wic : TWICImage;
  _bs : TBytesStream;
  _bmp  : TBitmap;
begin
  if not(string(aStr) > '') then
  begin
    aHandle := 0;
    Exit;
  end;
  wic := TWICImage.Create;
  _bs := TBytesStream.Create(TNetEncoding.Base64.DecodeStringToBytes(String(aStr)));
  _bs.Position := 0;
  wic.LoadFromStream(_bs);
  _bmp := TBitmap.Create;
  _bmp.Assign(wic);
  aHandle := _bmp.Handle;
  _bs.Free;
end;
acucobol help guide info
Quote:

W$BITMAP

This routine is a collection of related operations that handle bitmapped (BMP and JPEG) images. Only Windows machines can actually display bitmaps. On all other machines, this routine returns an error code.
Usage



CALL "W$BITMAP" USING OP-CODE, parameters, GIVING BITMAP-HANDLE





Parameters

OP-CODE Numeric parameter Selects the W$BITMAP operation to perform. The file acugui.def contains level 78 symbolic names for these operations. Unless otherwise noted, these operations can be used in a thin client environment. The specific operations are described below.
parameters Vary depending on the op-code chosen.
BITMAP-HANDLE PIC S9(9) COMP-4 (or COMP-5) BITMAP-HANDLE holds the return value of W$BITMAP. Values less than or equal to zero indicate errors. If you are loading or destroying ImageLists, this should be a COMP-5 field.


Description

W$BITMAP can be used to display a bitmapped image, load a bitmapped image into memory, or remove a bitmapped image and free its memory. You can use this routine to load a bitmapped image into memory as a Windows API data type called an ImageList, which treats the bitmap file as a series of fixed-width images. This provides a simplified way to load and destroy ImageLists when using the thin client. This routine can be used to capture screen shots of an active window or desktop. This routine can also be used to load IPictureDisp objects.
When it is trying to locate a bitmap file, W$BITMAP will search first for a resource with the specified name, and then for a disk file. Resources are named in a fashion similar to disk files, but without any directory information. (See the COPY RESOURCE statement in ACUCOBOL-GT Reference Manual for more information about including resources.)
Note: When you are running in a thin client environment, and a file name beginning with @[DISPLAY] is passed to this routine, it will attempt to access the file in the display host's file system. It does not download the file from the server. For more information, refer to the topic Using Library Routines and DLLs in Thin Client, in the AcuConnect User's Guide.
W$BITMAP will examine files to determine the type of image format. If the file suffix is .jpg, .jpe or .jpeg, W$BITMAP assumes the file is a JPEG image. Otherwise, it assumes the files are in BMP format. In order to read JPG files, you must have the file ajpg32.dll installed in the runtime directory. Only 32-bit runtimes support JPEG format images. If you need JPEG support on 64-bit Windows, run the 32-bit runtime or the Thin Client. You can also run the Thin Client with the 64-bit runtime.
W$BITMAP loads 24-bit color or 8-bit grayscale images in the JPEG File Interchange Format (JFIF). It reads baseline and extended DCT sequential and progressive files that are Huffman encoded (file types SOF0, SOF1, SOF2). The JPG lossless mode format is not supported.
Note: The behavior of this library routine is affected by the setting of the FILENAME_SPACES configuration variable that may or may not allow spaces in a file name. See the documentation on FILENAME_SPACES in Appendix H.

Parent topic: General Syntax and Library List





Send feedback about this topic