Clarion FreeImage
  Related Projects
  What's Next?
  Contact Us
   Make a Donation

New Version 3.15.6 (2015.12.05)
available now.


How do I add an image control to an application

How do I add an image control to a hand coded project

When Linking I receive the error message: "Link error: Unsupported record type21"

I receive Windows error 14001 when executing my program

How do I add an image control to an application:

First you must add the global extension template labeled Activate_ClarionFreeImage to your application. This extension includes the class files and set the project defines for link and DLL mode. To do this follow these steps:

  1. Open the application's Global Properties dialog by selecting Application from the main menu and then choose Global Properties... from the pop up menu.

  2. Click the Extensions button and the Extension and Control Templates dialog is displayed.

  3. Click the Insert button on the Extension and Control Templates dialog.

  4. Select the Activate_ClarionFreeImage from the Select Extension dialog's list.

  5. Click the Select button on the Select Extension dialog and the extention is added to the list of extensions for this application.

If you intend to use the built in image dialogs (like Brightness and Contrast, Gamma correction, Rescaling...) you must check the Include Dialog support box. If you attempt to use one of the built in dialogs without checking this box, the compiler will inform you need to check this box.

Next, go to the window where you want to display an image and add the Clarion FreeImage Control template. To do this follow these steps:

  1. Select Populate from the main menu and then select Control Templates... from the popup or select the Control Template icon on the Control toolbox.

  2. Select the ClarionFreeImageControl from the Select Control Template dialog.

  3. Click the Select button.

  4. Draw the control on your window.

This places a region control on your window with a default label of ?ImageCtrl. The region is replaced with the image control at runtime. However, you can still refer to the region control's in your code to do things like move or hide it with Clarion property syntax.

You can now access the properties of the Clarion FreeImage control on the Actions tab of the region's properties.


How to add an image control to a hand coded project:

When you want to include the Clarion FreeImage control in a hand coded project you'll need to follow these steps:

  1. Add the link library file FreeImage.lib to the Library, Object, and Resource files node of the project tree. This link libary is used to resolve the references in FreeImage.DLL. If you forget this step, you will receive many "...unresolved..." link errors.

  2. Add the Link and DLL mode defines to your project's Global Options, Defines tab. These are used in the class headers. Failure to set these project defines will result in a GPF as soon as one of the class constructors fires at startup.


  3. Include the class header files globally. It's very important that you do not include this in a procedure as it will lead to GPF's and general instability.


  4. To use the built in image dialogs, include it's header globally. This should be with the header file defined in step 3.


  5. Place a region control on your window where you want the image control displayed. For this example assume it's label is "?ImageCtrl".

  6. Instantiate the Clarion FreeImage control class like this:

    theImage cfiImageControl

  7. When using the image control dialogs, instantiate a dialog class like this:

    cfiDialogs cfiDialogsClass

  8. After the window opens you must initialize the image control by calling the iImageControl interface Init method with the label of the region control that's holding it's place on the window and the border and scroll bar options.

    If theImage.iImageControl.Init(?ImageControl, CFIBS_SUNKEN, CFISB_BOTH) = False
      Message('Unable to initialize the image control', |
          'Clarion FreeImage project example',Icon:Exclamation)

  9. Initialize the image control dialogs, when used, by passing the dialog class an iImageControl interface and an iImage interface from the Clarion FreeImage class that you are associating the dialog class with:

    cfiDialogs.Init(theImage.iImageControl, theImage.iImage)

  10. Call the iImage interface Load method to load an image into the control.

    If theImage.iImage.Load(sFileName) = False
      Return !Unable to load the image

  11. Call the iImageControl interface Reset method to display the image.




When Linking I receive the error message: "Link error: Unsupported record type21"

This means that you have copied the the freeimage.lib file supplied with the FreeImage.Dll. This link library is in a format that Clarion does not recognize. You can either reinstall Clarion FreeImage or run the Clarion utility LibMaker.exe on the FreeImage.Dll and create a new freeimage.lib.



I receive Windows error 14001 when executing my program

This error is caused by a corrupt application manifest that includes Windows Vista information. Clarion 6.3 build 9058 has an error in the shipping manifest template. A replacement was posted by Softvelocity and you may download a copy of the VistaManifest.tpw here.

Simply copy the file to your %ClarionRoot%\TEMPLATE folder and recompile your application.