IonicWind Software

IWBasic => General Questions => Topic started by: h3kt0r on December 31, 2019, 01:01:32 AM

Title: Catfood Software Utility DLL - RLIB.DLL
Post by: h3kt0r on December 31, 2019, 01:01:32 AM
Found this DLL that may be interesting to someone.
I think it might be used in an iwBasic application but i still have
to write a sample program to test its functions.

Detailed instructions are contained within the following header files:

DLList.h - Linked list functions
Hyperlink.h - Hyperlink control for use in dialog boxes
GDIMagic.h - Transparant BitBlt and StretchBlt
MButton.h - Web style rollover controls
AClock.h - Analog clock control


Package attached to this post.
Title: Re: Catfood Software Utility DLL - RLIB.DLL
Post by: h3kt0r on January 23, 2020, 10:22:59 AM
I've started to work on a sample program to demonstrate the RLIB functions and i went into some trouble
with the "TBitBlt" function. This function accepts the exact same parameters as "BitBlt" except it adds one
more parameter, which is the transparent color.
This parameter is passed to the function in the form of a "COLORREF" value which is defined by the "Win32
Programmer's Reference" as follows :


QuoteThe COLORREF value is a 32-bit value used to specify an RGB color.

Remarks

When specifying an explicit RGB color, the COLORREF value has the following hexadecimal form:

0x00bbggrr


The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero. The maximum value for a single byte is 0xFF.

So, i'm creating a BITMAP in a memory DC, fill it with the transparent color (which is pink), then write a text string
and call the function with the color value in hexadecimal form (which is 0xFF00FF).
But this does not work :

QuoteCompiling...
RLIB_Sample.iwb
File: A:\Project\rlib\RLIB_Sample.iwb (117) Error: Unable to convert int to structure
Error(s) in compiling A:\Project\rlib\RLIB_Sample.iwb
When i replace the COLORREF parameter by an INTEGER, the program compiles and the BITMAP is transferred

on the window canvas, but the transparent color too. (See compiled sample in attached file).

My question is : how do i use this COLORREF parameter to make the program work correctly ?
Title: Re: Catfood Software Utility DLL - RLIB.DLL
Post by: Andy on January 23, 2020, 08:45:13 PM
Hi,

Well it depends on what you are asking, if it works passing an integer then that's simple.

There are posts on here to convert hex to decimal, but for a quick start, you can use my string map function

SMHexToDec

Link is here:
https://www.ionicwind.com/forums/index.php?topic=5866.msg43398#msg43398

All you have to do is then is use VAL to get the integer value and pass that instead of the hex value.

If the transparency is the problem, I'm sure someone with better graphics knowledge can help out.

Andy.
 
Title: Re: Catfood Software Utility DLL - RLIB.DLL
Post by: h3kt0r on January 23, 2020, 10:00:04 PM
Thank you, i'll give this a try.

I've updated the code for the sample program, see attached ZIP file in the first post...

If someone could have a look at what i'm trying to do and give some advice, that would be great.
Title: Re: Catfood Software Utility DLL - RLIB.DLL
Post by: aurelCB on January 24, 2020, 01:44:45 AM
This example confused me a lot ,first i don't see any advantage of using this DLL over already built in
win32 BitBlt , second i get whole bunch of errors under EB.(yes i still use that oldie)

My question is do you try same thing using just API functions?
Title: Re: Catfood Software Utility DLL - RLIB.DLL
Post by: h3kt0r on January 24, 2020, 01:58:24 AM
This is an exercise. I just want to learn to use a simple DLL written in C language.
So, now i've created a project file, added some resources (images for the bitmap button).
I've found out that the HINSTANCE member of the MBUTTON_DATA TYPE does :

QuoteIdentifies the instance of the module whose executable file contains the bitmap to be loaded.
Which is a good thing. Still, i have no clue where i can find this instance.

Whenever i replace HINSTANCE by a UINT, the linker spits out that error :

QuoteCompiling Resources...
No Errors

Compiling...
RLIB_Sample.iwb

Linking...
IWBasic Linker v1.11 Copyright © 2011 Ionic Wind Software
Unresolved external _ib_main
Error: C:\iwbdev\libs\winmain.o - Unresolved extern _ib_main
Error(s) in linking RLIB_Sample.exe
So, i guess i have to stick with it.  Someone knows something about HINSTANCE ?


P.S : files updated, see first post to get attachment...
Title: Re: Catfood Software Utility DLL - RLIB.DLL
Post by: Brian on January 24, 2020, 02:52:20 AM
I think you will find HINSTANCE is an INT

Brian
Title: Re: Catfood Software Utility DLL - RLIB.DLL
Post by: h3kt0r on January 24, 2020, 03:21:50 AM
Fine; So, as it would not compile as a project with resources, i've modified the source to let the
program load bitmap files from the disk.
I've also swapped HINSTANCE for UINT and found an API call* to pass a value to the "hInstRes" member
of the "MBUTTON_DATA" TYPE.
It compiles okay but when i run the program, it won't display the button bitmaps on the static control.
That's it for now. I'll keep on searching until everything works, meanwhile, every suggestion is welcome.

*_GetModuleHandle(NULL)
Title: Re: Catfood Software Utility DLL - RLIB.DLL
Post by: Brian on January 24, 2020, 03:48:36 AM
Well, I managed to get it to compile as a project. Did you forget to put $main at the top? Won't conpile as a project without it
And you appear to be using an old version of the windows sdk include files
Brian
Title: Re: Catfood Software Utility DLL - RLIB.DLL
Post by: h3kt0r on January 24, 2020, 10:28:40 AM
Ooops ! You're absolutely right. I forgot to put "$Main" at the top.
As for the include file, i don't know what to say except that i've got the SDK includes from
the Sapero installation program found on this forum...
Title: Re: Catfood Software Utility DLL - RLIB.DLL
Post by: Brian on January 24, 2020, 11:02:23 AM
Well, if you are using Sapero's files, the $include statement should be $include "windowssdk.inc" and not just "windows.inc"

I have had a go with your program, and altered the TYPEs somewhat, and also a couple of the Declares. Didn't use the POINTERs

Brian

If you haven't got the latest Sapero include files, get them from here:
http://www.ionicwind.com/forums/index.php?topic=4983.msg37938#msg37938

Title: Re: Catfood Software Utility DLL - RLIB.DLL
Post by: h3kt0r on January 24, 2020, 01:53:16 PM
All right guys, thanks to the help provided by Brian, now there are four working functions in the sample.
Still have to dig the MButtonSubclassStatic to make it work and next there is the double
linked list function (which was designed for multiple level undo/redo)...

Updated the files --> see attachment in first post.
Title: Re: Catfood Software Utility DLL - RLIB.DLL
Post by: aurelCB on January 25, 2020, 01:51:55 AM
Well if you wish to play with DLL s i can make DLL in another basic compiler then you may try it
Title: Re: Catfood Software Utility DLL - RLIB.DLL
Post by: h3kt0r on January 25, 2020, 06:49:43 AM
Sounds like an idea. Okay then, i'll be happy to test your library.